libretro: make getRAM const

use shadow ram copy for frontend
This commit is contained in:
trinemark 2019-04-28 15:59:38 -05:00 committed by Stephen Anthony
parent 3f9ca310c3
commit f69cc5cb6c
3 changed files with 11 additions and 6 deletions

View File

@ -123,14 +123,12 @@ class M6532 : public Device
*/ */
void updateEmulation(); void updateEmulation();
#ifdef __LIB_RETRO__
/** /**
Get a pointer to the RAM contents. Get a pointer to the RAM contents.
@return Pointer to RAM array. @return Pointer to RAM array.
*/ */
uInt8* getRAM() { return myRAM; } const uInt8* getRAM() const { return myRAM; }
#endif
private: private:

View File

@ -158,6 +158,10 @@ void StellaLIBRETRO::destroy()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::runFrame() void StellaLIBRETRO::runFrame()
{ {
// write ram updates
for(int lcv = 0; lcv <= 127; lcv++)
myOSystem->console().system().m6532().poke(lcv | 0x80, system_ram[lcv]);
// poll input right at vsync // poll input right at vsync
updateInput(); updateInput();
@ -167,7 +171,8 @@ void StellaLIBRETRO::runFrame()
// drain generated audio // drain generated audio
updateAudio(); updateAudio();
// give user time to respond // refresh ram copy
memcpy(system_ram, myOSystem->console().system().m6532().getRAM(), 128);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -62,7 +62,7 @@ class StellaLIBRETRO
uInt32 getROMSize() { return rom_size; } uInt32 getROMSize() { return rom_size; }
uInt32 getROMMax() { return 512 * 1024; } uInt32 getROMMax() { return 512 * 1024; }
uInt8* getRAM() { return myOSystem->console().system().m6532().getRAM(); } uInt8* getRAM() { return system_ram; }
uInt32 getRAMSize() { return 128; } uInt32 getRAMSize() { return 128; }
size_t getStateSize(); size_t getStateSize();
@ -151,7 +151,9 @@ class StellaLIBRETRO
uInt32 audio_samples; uInt32 audio_samples;
// (31440 rate / 50 Hz) * 16-bit stereo * 1.25x padding // (31440 rate / 50 Hz) * 16-bit stereo * 1.25x padding
static const uInt32 audio_buffer_max = (31440 / 50 * 4 * 5) / 4; const uInt32 audio_buffer_max = (31440 / 50 * 4 * 5) / 4;
uInt8 system_ram[128];
private: private:
string video_palette; string video_palette;