Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
Potator
Commits
356b6951
Unverified
Commit
356b6951
authored
Mar 19, 2021
by
jdgleaver
Committed by
GitHub
Mar 19, 2021
Browse files
Merge pull request #3 from jdgleaver/memory-map
libretro: Export memory map via RETRO_ENVIRONMENT_SET_MEMORY_MAPS
parents
f9e8de77
b58c4a98
Pipeline
#17849
passed with stages
in 5 minutes and 10 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
platform/libretro/libretro.c
View file @
356b6951
...
...
@@ -45,6 +45,7 @@ static uint16 *video_buffer = NULL;
static
uint8
*
audio_samples_buffer
=
NULL
;
static
int16_t
*
audio_out_buffer
=
NULL
;
uint8
*
rom_data
=
NULL
;
size_t
rom_size
=
0
;
struct
sv_color_scheme
{
...
...
@@ -183,6 +184,27 @@ static void update_audio(void)
audio_batch_cb
(
audio_out_buffer
,
AUDIO_BUFFER_SIZE
>>
1
);
}
static
void
init_retro_memory_map
(
void
)
{
bool
cheevos_supported
=
true
;
const
uint64_t
ram_flags
=
RETRO_MEMDESC_SYSTEM_RAM
;
const
uint64_t
rom_flags
=
RETRO_MEMDESC_CONST
;
struct
retro_memory_map
mmaps
=
{
0
};
struct
retro_memory_descriptor
descs
[
4
]
=
{
{
ram_flags
,
memorymap_getLowerRamPointer
(),
0
,
0x0000
,
0
,
0
,
0x2000
,
"RAMLO"
},
{
ram_flags
,
memorymap_getRegisters
(),
0
,
0x2000
,
0
,
0
,
0x2000
,
"RAMREG"
},
{
ram_flags
,
memorymap_getUpperRamPointer
(),
0
,
0x4000
,
0
,
0
,
0x2000
,
"RAMHI"
},
{
rom_flags
,
rom_data
,
0
,
0x8000
,
0
,
0
,
0x8000
,
"ROM"
},
};
mmaps
.
descriptors
=
descs
;
mmaps
.
num_descriptors
=
sizeof
(
descs
)
/
sizeof
(
*
descs
);
environ_cb
(
RETRO_ENVIRONMENT_SET_MEMORY_MAPS
,
&
mmaps
);
environ_cb
(
RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS
,
&
cheevos_supported
);
}
/************************************
* libretro implementation
************************************/
...
...
@@ -287,7 +309,8 @@ bool retro_load_game(const struct retro_game_info *info)
}
/* Potator requires a *copy* of the ROM data */
rom_data
=
(
uint8
*
)
malloc
(
info
->
size
);
rom_size
=
info
->
size
;
rom_data
=
(
uint8
*
)
malloc
(
rom_size
);
if
(
!
rom_data
)
{
...
...
@@ -296,13 +319,13 @@ bool retro_load_game(const struct retro_game_info *info)
return
false
;
}
memcpy
(
rom_data
,
(
const
uint8
*
)
info
->
data
,
info
->
size
);
memcpy
(
rom_data
,
(
const
uint8
*
)
info
->
data
,
rom_
size
);
/* Initialise emulator */
supervision_init
();
/* Load ROM */
success
=
supervision_load
(
rom_data
,
info
->
size
);
success
=
supervision_load
(
rom_data
,
rom_
size
);
if
(
success
)
{
...
...
@@ -311,6 +334,9 @@ bool retro_load_game(const struct retro_game_info *info)
/* Apply initial core options */
check_variables
(
true
);
/* Initialise frontend memory map */
init_retro_memory_map
();
}
return
success
;
...
...
@@ -333,6 +359,8 @@ void retro_unload_game(void)
free
(
rom_data
);
rom_data
=
NULL
;
}
rom_size
=
0
;
}
unsigned
retro_get_region
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment