Build fixes for linux

This commit is contained in:
Jeffrey Pfau 2013-04-26 03:08:52 -07:00
parent 3cd5e8d093
commit 13c95a2aae
9 changed files with 16 additions and 11 deletions

View File

@ -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)

View File

@ -250,7 +250,7 @@ void ARMStep(struct ARMCore* cpu) {
#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)

View File

@ -281,8 +281,8 @@ DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(MVN, cpu->gprs[rd] = ~cpu->gprs[rn]; THUMB_
#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 @@ DEFINE_INSTRUCTION_THUMB(BX,
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 {

View File

@ -6,7 +6,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include "linenoise.h"

View File

@ -5,6 +5,7 @@
#include "gba-memory.h"
#include <math.h>
#include <stdlib.h>
static void _unLz77(struct GBAMemory* memory, uint32_t source, uint8_t* dest);

View File

@ -161,6 +161,5 @@ static void GBAVideoDummyRendererDrawScanline(struct GBAVideoRenderer* renderer,
static void GBAVideoDummyRendererFinishFrame(struct GBAVideoRenderer* renderer) {
(void)(renderer);
printf("Drawing a frame\n");
// Nothing to do
}

View File

@ -228,7 +228,7 @@ void GBAAttachDebugger(struct GBA* gba, struct ARMDebugger* 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
}

View File

@ -18,7 +18,8 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
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);

View File

@ -3,8 +3,12 @@
#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>