@@ -258,7 +258,6 @@ extern u32 oam_update;
258258extern u32 gbc_sound_wave_update ;
259259extern dma_transfer_type dma [DMA_CHAN_CNT ];
260260
261- extern const u8 open_gba_bios_rom [1024 * 16 ];
262261extern u16 palette_ram [512 ];
263262extern u16 oam_ram [512 ];
264263extern u16 palette_ram_converted [512 ];
@@ -328,4 +327,32 @@ bool memory_check_savestate(const u8*src);
328327bool memory_read_savestate (const u8 * src );
329328unsigned memory_write_savestate (u8 * dst );
330329
330+
331+ #ifdef RETRO_GO
332+ // We wrap certain globals to move them under a dynamic allocation, whilst still preserving the functionality
333+ // of any code treating them as fixed arrays. This results in very minimal code changes to the rest of gbSP.
334+ typedef struct
335+ {
336+ // TODO: Evaluate what is best left in internal memory for performance reasons (for the few that could fit)
337+ u8 vram [1024 * 96 ];
338+ u8 bios_rom [1024 * 16 ];
339+ u8 ewram [1024 * 256 * 2 ];
340+ u8 iwram [1024 * 32 * 2 ];
341+ u8 * memory_map_read [8 * 1024 ];
342+ u8 gamepak_backup [1024 * 128 ];
343+ // There's also stuff from video.cpp to consider:
344+ // u8 obj_priority_list[5][160][128];
345+ // u8 obj_priority_count[5][160];
346+ // u8 obj_alpha_count[160];
347+ } gbsp_memory_t ;
348+
349+ extern gbsp_memory_t * gbsp_memory ;
350+ #define vram gbsp_memory->vram
351+ #define bios_rom gbsp_memory->bios_rom
352+ #define ewram gbsp_memory->ewram
353+ #define iwram gbsp_memory->iwram
354+ #define memory_map_read gbsp_memory->memory_map_read
355+ #define gamepak_backup gbsp_memory->gamepak_backup
356+ #endif
357+
331358#endif
0 commit comments