diff --git a/libretroBuildSystem/libretro.c b/libretroBuildSystem/libretro.c index 1da5ded..1d14855 100644 --- a/libretroBuildSystem/libretro.c +++ b/libretroBuildSystem/libretro.c @@ -376,32 +376,32 @@ size_t retro_serialize_size(void) bool retro_serialize(void *data, size_t size) { - if(size < emulatorGetStateSize()) - return false; + buffer_t saveBuffer; - emulatorSaveState((uint8_t*)data); - return true; + saveBuffer.data = (uint8_t*)data; + saveBuffer.size = size; + + return emulatorSaveState(saveBuffer); } bool retro_unserialize(const void *data, size_t size) { - if(size < emulatorGetStateSize()) - return false; + buffer_t saveBuffer; - emulatorLoadState((uint8_t*)data); - return true; + saveBuffer.data = (uint8_t*)data; + saveBuffer.size = size; + + return emulatorLoadState(saveBuffer); } void *retro_get_memory_data(unsigned id) { - //Palm m515 is too complicated for SRAM, use savestates - return NULL; + return emulatorGetRamBuffer().data; } size_t retro_get_memory_size(unsigned id) { - //Palm m515 is too complicated for SRAM, use savestates - return 0; + return emulatorGetRamBuffer().size; } void retro_cheat_reset(void) diff --git a/src/emulator.c b/src/emulator.c index e57e172..033f75c 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -535,30 +535,13 @@ bool emulatorLoadState(buffer_t buffer){ return true; } -uint64_t emulatorGetRamSize(){ - return palmSpecialFeatures & FEATURE_RAM_HUGE ? SUPERMASSIVE_RAM_SIZE : RAM_SIZE; -} +buffer_t emulatorGetRamBuffer(){ + buffer_t ramInfo; -bool emulatorGetRam(buffer_t buffer){ - uint32_t ramSize = emulatorGetRamSize(); + ramInfo.data = palmRam; + ramInfo.size = palmSpecialFeatures & FEATURE_RAM_HUGE ? SUPERMASSIVE_RAM_SIZE : RAM_SIZE; - if(buffer.size < ramSize) - return false;//invalid buffer, too small - - memcpy(buffer.data, palmRam, ramSize); - - return true; -} - -bool emulatorSetRam(buffer_t buffer){ - uint32_t ramSize = emulatorGetRamSize(); - - if(buffer.size < ramSize) - return false;//invalid RAM block, too small - - memcpy(palmRam, buffer.data, ramSize); - - return true; + return ramInfo; } uint32_t emulatorInstallPrcPdb(buffer_t file){ diff --git a/src/emulator.h b/src/emulator.h index 8610688..d56d8a3 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -157,14 +157,12 @@ void emulatorExit(); void emulatorReset(); void emulatorSetRtc(uint16_t days, uint8_t hours, uint8_t minutes, uint8_t seconds); uint32_t emulatorSetNewSdCard(uint64_t size, uint8_t type); -buffer_t emulatorGetSdCardImage();//doing anything with the emulator will alter this, do not free it, it is a direct pointer to the sdcard data +buffer_t emulatorGetSdCardImage();//this is a direct pointer to the sdcard data, do not free it uint32_t emulatorSetSdCardFromImage(buffer_t image, uint8_t type); uint64_t emulatorGetStateSize(); bool emulatorSaveState(buffer_t buffer);//true = success bool emulatorLoadState(buffer_t buffer);//true = success -uint64_t emulatorGetRamSize(); -bool emulatorGetRam(buffer_t buffer);//true = success -bool emulatorSetRam(buffer_t buffer);//true = success +buffer_t emulatorGetRamBuffer();//this is a direct pointer to RAM, do not free it uint32_t emulatorInstallPrcPdb(buffer_t file); void emulateFrame(); diff --git a/src/sdcard.c b/src/sdcard.c index 4ec945e..0fca9b5 100644 --- a/src/sdcard.c +++ b/src/sdcard.c @@ -16,6 +16,7 @@ static uint64_t sdCardSize; static inline void updateChunkBufferLength(){ uint64_t newChunkLength = 0; + while(true){ newChunkLength++; if(sdCardChunks[newChunkLength] == 0x0000000000000000) @@ -81,6 +82,7 @@ uint32_t sdCardReconfigure(uint64_t size){ buffer_t sdCardGetImage(){ buffer_t image; + image.data = sdCardData; image.size = sdCardSize; diff --git a/unimplementedHardware.txt b/unimplementedHardware.txt index 7182c66..d15fc9d 100644 --- a/unimplementedHardware.txt +++ b/unimplementedHardware.txt @@ -29,7 +29,7 @@ port d IRQ* bits edge triggered interrupt mode is not emulated edgeTriggeredInterruptLastValue may need to be locked when PLL is off port d data register seems to have its data bits cleared when an edge triggered interrupt is cleared(according to MC68VZ328UM.pdf Page 10-15) Dont know if it possible to have the backlight on and the display off at the same time(theres no reason for it but it may be possible) -power button must be pushed twice to turn the CPU back on(when debugging it works the first time, then must be pushed twice to turn off instead of on) +power button must be pushed twice to turn the CPU back on(when debugging it works the first time, then must be pushed twice to turn off instead of on)(this also occurs in the RetroArch build) STOP opcode may be causing issues with the power button(it may be setting a separate CPU disable option) Debug tools: