Skip to content

Commit

Permalink
Applied speedhax again. (Increase performance boost at certain points.)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nunatica committed Aug 16, 2016
1 parent b8bb033 commit 0ddefb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FRONTEND_SUPPORTS_RGB565=1
TILED_RENDERING=0
STATIC_LINKING=0
USE_CHEATS=1
USE_TWEAKS=1
USE_TWEAKS=0
USE_THREADED_RENDERER=0

CORE_DIR := .
Expand Down
31 changes: 4 additions & 27 deletions src/gba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ inline static long min(long p, int q) { return p < q ? p : q; }
inline static long min(int p, long q) { return p < q ? p : q; }
inline static long min(long p, long q) { return p < q ? p : q; }

#if USE_TWEAK_MEMORY

uint8_t *rom = 0;
uint8_t bios[0x4000];
uint8_t vram[0x20000];
uint16_t pix[4 * PIX_BUFFER_SCREEN_WIDTH * 160];
uint8_t oam[0x400];
uint8_t ioMem[0x400];
uint8_t internalRAM[0x8000];
uint8_t workRAM[0x40000];
uint8_t paletteRAM[0x400];

#else

uint8_t *rom = 0;
uint8_t *bios = 0;
uint8_t *vram = 0;
Expand All @@ -69,8 +55,6 @@ uint8_t *internalRAM = 0;
uint8_t *workRAM = 0;
uint8_t *paletteRAM = 0;

#endif

#if THREADED_RENDERER

#define THREADED_RENDERER_COPY_BUFFER 0
Expand Down Expand Up @@ -5971,7 +5955,11 @@ static void thumbD0(u32 opcode)
bus.armNextPC = bus.reg[15].I;
bus.reg[15].I += 2;
THUMB_PREFETCH;
#if USE_TWEAK_SPEEDHAX
clockTicks = 30;
#else
clockTicks = CLOCKTICKS_UPDATE_TYPE16P;
#endif
bus.busPrefetchCount=0;
}
}
Expand Down Expand Up @@ -8823,7 +8811,6 @@ void CPUCleanUp (void)
rom = NULL;
}

#if !USE_TWEAK_MEMORY
if(vram != NULL) {
free(vram);
vram = NULL;
Expand Down Expand Up @@ -8863,7 +8850,6 @@ void CPUCleanUp (void)
free(ioMem);
ioMem = NULL;
}
#endif

}

Expand All @@ -8877,12 +8863,6 @@ bool CPUSetupBuffers()

rom = (uint8_t *)malloc(0x2000000);

#if USE_TWEAK_MEMORY
if(rom == NULL) {
CPUCleanUp();
return false;
}
#else
workRAM = (uint8_t *)calloc(1, 0x40000);
bios = (uint8_t *)calloc(1,0x4000);
internalRAM = (uint8_t *)calloc(1,0x8000);
Expand All @@ -8898,7 +8878,6 @@ bool CPUSetupBuffers()
CPUCleanUp();
return false;
}
#endif

flashInit();
eepromInit();
Expand Down Expand Up @@ -8930,10 +8909,8 @@ int CPULoadRom(const char * file)
romSize)) {
free(rom);
rom = NULL;
#if !USE_TWEAK_MEMORY
free(workRAM);
workRAM = NULL;
#endif
return 0;
}
}
Expand Down
18 changes: 1 addition & 17 deletions src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//performance boost tweaks.
#if USE_TWEAKS
#define USE_TWEAK_ARCTAN 1
#define USE_TWEAK_MEMORY 0
#define USE_TWEAK_SPEEDHAX 1
#define USE_TWEAK_INTERLACE 0
#endif

Expand All @@ -24,20 +24,6 @@ extern bool skipSaveGameBattery; // skip battery data when reading save states

extern int cpuDmaCount;

#if USE_TWEAK_MEMORY

extern uint8_t *rom;
extern uint8_t bios[0x4000];
extern uint8_t vram[0x20000];
extern uint16_t pix[4 * PIX_BUFFER_SCREEN_WIDTH * 160];
extern uint8_t oam[0x400];
extern uint8_t ioMem[0x400];
extern uint8_t internalRAM[0x8000];
extern uint8_t workRAM[0x40000];
extern uint8_t paletteRAM[0x400];

#else

extern uint8_t *rom;
extern uint8_t *bios;
extern uint8_t *vram;
Expand All @@ -48,6 +34,4 @@ extern uint8_t *internalRAM;
extern uint8_t *workRAM;
extern uint8_t *paletteRAM;

#endif

#endif // GLOBALS_H

0 comments on commit 0ddefb5

Please sign in to comment.