From 5a96997f186b2cff1a24ed5572430fe0f031e8d3 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 28 Oct 2014 03:13:05 +0100 Subject: initial libretro port. --- source/apu.cpp | 2 +- source/cpuexec.cpp | 6 +++--- source/display.h | 4 ++-- source/font.h | 2 +- source/getset.h | 14 +++++++------- source/gfx.h | 2 +- source/memmap.cpp | 6 +++--- source/movie.cpp | 2 +- source/nds/displaymodes.cpp | 4 ++-- source/nds/draw.h | 10 ++++++---- source/nds/entry.cpp | 10 +++++----- source/nds/gui.h | 4 ++-- source/port.h | 6 +++++- source/sa1.cpp | 6 +++--- source/snapshot.cpp | 28 ++++++++++++++-------------- source/snes9x.h | 5 +++-- 16 files changed, 59 insertions(+), 52 deletions(-) (limited to 'source') diff --git a/source/apu.cpp b/source/apu.cpp index 769d2bc..53e0425 100644 --- a/source/apu.cpp +++ b/source/apu.cpp @@ -408,7 +408,7 @@ void S9xSetAPUDSP (uint8 byte) { IAPU.Registers.PC = IAPU.PC - IAPU.RAM; S9xAPUPackStatus(); - S9xSPCDump (S9xGetFilenameInc (".spc")); + S9xSPCDump (".spc"); spc_is_dumping = 0; } } diff --git a/source/cpuexec.cpp b/source/cpuexec.cpp index 30dff21..d8c2b31 100644 --- a/source/cpuexec.cpp +++ b/source/cpuexec.cpp @@ -86,9 +86,9 @@ Super NES and Super Nintendo Entertainment System are trademarks of Nintendo Co., Limited and its subsidiary companies. *******************************************************************************/ -#include "ds2_timer.h" -#include "ds2_cpu.h" -#include "ds2io.h" +//#include "ds2_timer.h" +//#include "ds2_cpu.h" +//#include "ds2io.h" #include "snes9x.h" #include "memmap.h" diff --git a/source/display.h b/source/display.h index d00c5ed..fb01934 100644 --- a/source/display.h +++ b/source/display.h @@ -100,12 +100,12 @@ void S9xExtraUsage (); #ifdef ACCUMULATE_JOYPAD void NDSSFCAccumulateJoypad (); #endif -uint32 S9xReadJoypad (int which1_0_to_4); +uint32 S9xReadJoypad (int port); bool8 S9xReadMousePosition (int which1_0_to_1, int &x, int &y, uint32 &buttons); bool8 S9xReadSuperScopePosition (int &x, int &y, uint32 &buttons); void S9xUsage (); -void S9xInitDisplay (int argc, char **argv); +void S9xInitDisplay (void); void S9xDeinitDisplay (); void S9xInitInputDevices (); void S9xSetTitle (const char *title); diff --git a/source/font.h b/source/font.h index f2edfd2..5720fbd 100644 --- a/source/font.h +++ b/source/font.h @@ -86,7 +86,7 @@ Super NES and Super Nintendo Entertainment System are trademarks of Nintendo Co., Limited and its subsidiary companies. *******************************************************************************/ -static char *font[] = { +static const char *font[] = { " . . . . .. . . ", " .#. .#.#. . . ... .#. . . .##. .#. .#. . . . . ", " .#. .#.#. .#.#. .###. .#..#. .#. .#. .#. .#. .#.#. .#. .#. ", diff --git a/source/getset.h b/source/getset.h index 02a3845..be81c23 100644 --- a/source/getset.h +++ b/source/getset.h @@ -120,7 +120,7 @@ uint8 S9xGetByte (uint32 Address) return (*(GetAddress + (Address & 0xffff))); } - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_PPU: return (S9xGetPPU (Address & 0xffff)); @@ -224,7 +224,7 @@ uint16 S9xGetWord (uint32 Address) #endif } - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_PPU: return (S9xGetPPU (Address & 0xffff) | @@ -347,7 +347,7 @@ void S9xSetByte (uint8 Byte, uint32 Address) return; } - switch ((int) SetAddress) + switch ((intptr_t) SetAddress) { case CMemory::MAP_PPU: S9xSetPPU (Byte, Address & 0xffff); @@ -480,7 +480,7 @@ void S9xSetWord (uint16 Word, uint32 Address) return; } - switch ((int) SetAddress) + switch ((intptr_t) SetAddress) { case CMemory::MAP_PPU: S9xSetPPU ((uint8) Word, Address & 0xffff); @@ -601,7 +601,7 @@ uint8 *GetBasePointer (uint32 Address) { return s7r.bank50; } - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_SPC7110_DRAM: #ifdef SPC7110_DEBUG @@ -667,7 +667,7 @@ uint8 *S9xGetMemPointer (uint32 Address) if(Settings.SPC7110&&((Address&0x7FFFFF)==0x4800)) return s7r.bank50; - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_SPC7110_DRAM: #ifdef SPC7110_DEBUG @@ -727,7 +727,7 @@ void S9xSetPCBase (uint32 Address) return; } - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_PPU: CPU.PCBase = Memory.FillRAM; diff --git a/source/gfx.h b/source/gfx.h index 88b2640..37a082e 100644 --- a/source/gfx.h +++ b/source/gfx.h @@ -109,7 +109,7 @@ extern struct SGFX GFX; bool8 S9xGraphicsInit (); void S9xGraphicsDeinit(); bool8 S9xInitUpdate (void); -bool8 S9xDeinitUpdate (int Width, int Height, bool8 sixteen_bit); +void S9xDeinitUpdate (int width, int height, bool8 sixteen_bit); void S9xSyncSpeed (); #ifdef GFX_MULTI_FORMAT diff --git a/source/memmap.cpp b/source/memmap.cpp index 20110f9..9ff1c02 100644 --- a/source/memmap.cpp +++ b/source/memmap.cpp @@ -114,9 +114,9 @@ #include "unzip/unzip.h" #ifdef DS2_DMA -#include "ds2_cpu.h" -#include "ds2_dma.h" -#include "dma_adj.h" +//#include "ds2_cpu.h" +//#include "ds2_dma.h" +//#include "dma_adj.h" #endif #ifdef __W32_HEAP diff --git a/source/movie.cpp b/source/movie.cpp index 9156a48..3ae0934 100644 --- a/source/movie.cpp +++ b/source/movie.cpp @@ -95,7 +95,7 @@ #include #include -#if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) +#if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) || defined (PSP) #include #include #include diff --git a/source/nds/displaymodes.cpp b/source/nds/displaymodes.cpp index ead3c93..173ead3 100644 --- a/source/nds/displaymodes.cpp +++ b/source/nds/displaymodes.cpp @@ -18,8 +18,8 @@ */ #include -#include "ds2_types.h" -#include "ds2io.h" +//#include "ds2_types.h" +//#include "ds2io.h" #include "gfx.h" diff --git a/source/nds/draw.h b/source/nds/draw.h index b696407..473fc30 100644 --- a/source/nds/draw.h +++ b/source/nds/draw.h @@ -20,8 +20,10 @@ #ifndef __DRAW_H__ #define __DRAW_H__ -#include "ds2_types.h" -#include "ds2io.h" +//#include "ds2_types.h" +//#include "ds2io.h" +#include + #include "bdf_font.h" #define NDS_SCREEN_WIDTH 256 @@ -176,8 +178,8 @@ extern void draw_hscroll_over(u32 index); extern void boxfill_alpha(u32 sx, u32 sy, u32 ex, u32 ey, u32 color, u32 alpha); extern void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now); extern u32 yesno_dialog(char *text); -extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no); -extern u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel); +//extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no); +//extern u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel); extern void msg_screen_init(const char *title); extern void msg_screen_draw(); extern void msg_printf(const char *text, ...); diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp index 1270d01..a6c1f7d 100644 --- a/source/nds/entry.cpp +++ b/source/nds/entry.cpp @@ -1,11 +1,11 @@ //entry.c #include -#include "ds2_types.h" -#include "ds2_cpu.h" -#include "ds2_timer.h" -#include "ds2io.h" -#include "fs_api.h" +//#include "ds2_types.h" +//#include "ds2_cpu.h" +//#include "ds2_timer.h" +//#include "ds2io.h" +//#include "fs_api.h" #include "snes9x.h" #include "soundux.h" diff --git a/source/nds/gui.h b/source/nds/gui.h index 980553b..92dc81d 100644 --- a/source/nds/gui.h +++ b/source/nds/gui.h @@ -20,8 +20,8 @@ #ifndef __GUI_H__ #define __GUI_H__ -#include "ds2_types.h" -#include "fs_api.h" +//#include "ds2_types.h" +//#include "fs_api.h" #include "gcheat.h" #define UP_SCREEN_UPDATE_METHOD 0 diff --git a/source/port.h b/source/port.h index 1e34410..719fc18 100644 --- a/source/port.h +++ b/source/port.h @@ -93,7 +93,7 @@ #include #ifndef STORM -#include +//#include #include #else #include @@ -111,7 +111,11 @@ #include /* #define PIXEL_FORMAT RGB565 */ +#ifdef PSP #define PIXEL_FORMAT BGR555 +#else +#define PIXEL_FORMAT RGB565 +#endif #define FOREVER_16_BIT // The above is used to disable the 16-bit graphics mode checks sprinkled // throughout the code, if the pixel format is always 16-bit. diff --git a/source/sa1.cpp b/source/sa1.cpp index addeed7..f67a9d6 100644 --- a/source/sa1.cpp +++ b/source/sa1.cpp @@ -201,7 +201,7 @@ uint8 S9xSA1GetByte (uint32 address) if (GetAddress >= (uint8 *) CMemory::MAP_LAST) return (*(GetAddress + (address & 0xffff))); - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_PPU: return (S9xGetSA1 (address & 0xffff)); @@ -248,7 +248,7 @@ void S9xSA1SetByte (uint8 byte, uint32 address) return; } - switch ((int) Setaddress) + switch ((intptr_t) Setaddress) { case CMemory::MAP_PPU: S9xSetSA1 (byte, address & 0xffff); @@ -310,7 +310,7 @@ void S9xSA1SetPCBase (uint32 address) return; } - switch ((int) GetAddress) + switch ((intptr_t) GetAddress) { case CMemory::MAP_PPU: SA1.PCBase = Memory.FillRAM - 0x2000; diff --git a/source/snapshot.cpp b/source/snapshot.cpp index c414dc2..a0575e7 100644 --- a/source/snapshot.cpp +++ b/source/snapshot.cpp @@ -532,19 +532,19 @@ static FreezeData SnapS7RTC [] = { //static char ROMFilename [_MAX_PATH]; //static char SnapshotFilename [_MAX_PATH]; -void FreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, - int num_fields); -void FreezeBlock (STREAM stream, char *name, uint8 *block, int size); +void FreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fields, + int num_fields); +void FreezeBlock (STREAM stream, const char *name, uint8 *block, int size); -int UnfreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, +int UnfreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fields, int num_fields); -int UnfreezeBlock (STREAM stream, char *name, uint8 *block, int size); +int UnfreezeBlock (STREAM stream, const char *name, uint8 *block, int size); -int UnfreezeStructCopy (STREAM stream, char *name, uint8** block, FreezeData *fields, int num_fields); +int UnfreezeStructCopy (STREAM stream, const char *name, uint8** block, FreezeData *fields, int num_fields); void UnfreezeStructFromCopy (void *base, FreezeData *fields, int num_fields, uint8* block); -int UnfreezeBlockCopy (STREAM stream, char *name, uint8** block, int size); +int UnfreezeBlockCopy (STREAM stream, const char *name, uint8** block, int size); bool8 Snapshot (const char *filename) { @@ -977,7 +977,7 @@ int FreezeSize (int size, int type) } } -void FreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, +void FreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fields, int num_fields) { // Work out the size of the required block @@ -1065,7 +1065,7 @@ void FreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, delete[] block; } -void FreezeBlock (STREAM stream, char *name, uint8 *block, int size) +void FreezeBlock (STREAM stream, const char *name, uint8 *block, int size) { char buffer [512]; sprintf (buffer, "%s:%06d:", name, size); @@ -1074,8 +1074,8 @@ void FreezeBlock (STREAM stream, char *name, uint8 *block, int size) } -int UnfreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, - int num_fields) +int UnfreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fields, + int num_fields) { // Work out the size of the required block int len = 0; @@ -1169,7 +1169,7 @@ int UnfreezeStruct (STREAM stream, char *name, void *base, FreezeData *fields, return (result); } -int UnfreezeBlock (STREAM stream, char *name, uint8 *block, int size) +int UnfreezeBlock (STREAM stream, const char *name, uint8 *block, int size) { char buffer [20]; int len = 0; @@ -1203,7 +1203,7 @@ int UnfreezeBlock (STREAM stream, char *name, uint8 *block, int size) return (SUCCESS); } -int UnfreezeStructCopy (STREAM stream, char *name, uint8** block, FreezeData *fields, int num_fields) +int UnfreezeStructCopy (STREAM stream, const char *name, uint8** block, FreezeData *fields, int num_fields) { // Work out the size of the required block int len = 0; @@ -1292,7 +1292,7 @@ void UnfreezeStructFromCopy (void *base, FreezeData *fields, int num_fields, uin } } -int UnfreezeBlockCopy (STREAM stream, char *name, uint8** block, int size) +int UnfreezeBlockCopy (STREAM stream, const char *name, uint8** block, int size) { *block = new uint8 [size]; int result; diff --git a/source/snes9x.h b/source/snes9x.h index ab70efa..443f518 100644 --- a/source/snes9x.h +++ b/source/snes9x.h @@ -93,9 +93,10 @@ #include #include +#include -#include "fs_api.h" -#include "ds2_malloc.h" +//#include "fs_api.h" +//#include "ds2_malloc.h" #ifdef __cplusplus extern "C" { -- cgit v1.2.3