Build fixes for linux
Jeffrey Pfau jeffrey@endrift.com
Fri, 26 Apr 2013 03:08:52 -0700
9 files changed,
16 insertions(+),
11 deletions(-)
M
CMakeLists.txt
→
CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.6) project(GBAc) -set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -Wno-unused -Werror") -set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall -Wextra -Wno-unused -Werror") +set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -Wno-unused -Werror --std=gnu99") +set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall -Wextra -Wno-unused -Werror --std=gnu99") file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c) file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c) file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/*.c)
M
src/arm/isa-arm.c
→
src/arm/isa-arm.c
@@ -250,7 +250,7 @@
#define ADDR_MODE_3_ADDRESS ADDR_MODE_2_ADDRESS #define ADDR_MODE_3_RN ADDR_MODE_2_RN #define ADDR_MODE_3_RM ADDR_MODE_2_RM -#define ADDR_MODE_3_IMMEDIATE ((opcode & 0x00000F00) >> 4) | (opcode & 0x0000000F) +#define ADDR_MODE_3_IMMEDIATE (((opcode & 0x00000F00) >> 4) | (opcode & 0x0000000F)) #define ADDR_MODE_3_INDEX(U_OP, M) ADDR_MODE_2_INDEX(U_OP, M) #define ADDR_MODE_3_WRITEBACK(ADDR) ADDR_MODE_2_WRITEBACK(ADDR)
M
src/arm/isa-thumb.c
→
src/arm/isa-thumb.c
@@ -281,8 +281,8 @@ DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, cpu->gprs[rd] = ~cpu->gprs[rn]; THUMB_NEUTRAL_S( , , cpu->gprs[rd]))
#define DEFINE_INSTRUCTION_WITH_HIGH_EX_THUMB(NAME, H1, H2, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ - int rd = opcode & 0x0007 | H1; \ - int rm = (opcode >> 3) & 0x0007 | H2; \ + int rd = (opcode & 0x0007) | H1; \ + int rm = ((opcode >> 3) & 0x0007) | H2; \ BODY;) #define DEFINE_INSTRUCTION_WITH_HIGH_THUMB(NAME, BODY) \@@ -461,7 +461,7 @@ int misalign = 0;
if (rm == ARM_PC) { misalign = cpu->gprs[rm] & 0x00000002; } - cpu->gprs[ARM_PC] = cpu->gprs[rm] & 0xFFFFFFFE - misalign; + cpu->gprs[ARM_PC] = (cpu->gprs[rm] & 0xFFFFFFFE) - misalign; if (cpu->executionMode == MODE_THUMB) { THUMB_WRITE_PC; } else {
M
src/debugger/debugger.c
→
src/debugger/debugger.c
@@ -6,7 +6,7 @@ #include <signal.h>
#include <stdio.h> #include <stdarg.h> #include <stdlib.h> -#include <strings.h> +#include <string.h> #include <unistd.h> #include "linenoise.h"
M
src/gba/gba-bios.c
→
src/gba/gba-bios.c
@@ -5,6 +5,7 @@ #include "gba-io.h"
#include "gba-memory.h" #include <math.h> +#include <stdlib.h> static void _unLz77(struct GBAMemory* memory, uint32_t source, uint8_t* dest);
M
src/gba/gba-video.c
→
src/gba/gba-video.c
@@ -161,6 +161,5 @@ }
static void GBAVideoDummyRendererFinishFrame(struct GBAVideoRenderer* renderer) { (void)(renderer); - printf("Drawing a frame\n"); // Nothing to do }
M
src/gba/gba.c
→
src/gba/gba.c
@@ -228,7 +228,7 @@ gba->debugger = debugger;
} void GBALoadROM(struct GBA* gba, int fd) { - gba->memory.rom = mmap(0, SIZE_CART0, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0); + gba->memory.rom = mmap(0, SIZE_CART0, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); // TODO: error check }
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -18,7 +18,8 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer* renderer, uint16_t value);
static void _compositeBackground(struct GBAVideoSoftwareRenderer* renderer, int offset, int entry, struct PixelFlags flags); static void _drawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int y); -static void _drawSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj* spritem, int y); +static void _drawTransformedSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBATransformedObj* sprite, int y); +static void _drawSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj* sprite, int y); static void _updatePalettes(struct GBAVideoSoftwareRenderer* renderer); static inline uint16_t _brighten(uint16_t color, int y);
M
src/main.c
→
src/main.c
@@ -3,8 +3,12 @@ #include "gba-thread.h"
#include "gba.h" #include "renderers/video-software.h" -#include <sdl.h> +#include <SDL.h> +#ifdef __APPLE__ #include <OpenGL/gl.h> +#else +#include <GL/gl.h> +#endif #include <fcntl.h> #include <errno.h>