mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
mods: support save-safe damage override and deadzone rounding
This commit is contained in:
@@ -34,6 +34,12 @@ uint16_t psx_mod_read_half(uint32_t address);
|
||||
void psx_mod_write_half(uint32_t address, uint16_t value);
|
||||
uint32_t psx_mod_read_word(uint32_t address);
|
||||
void psx_mod_write_word(uint32_t address, uint32_t value);
|
||||
/*
|
||||
* Replace one guest instruction and route that address through the runtime's
|
||||
* executable-RAM path. Use this instead of psx_mod_write_word for code so a
|
||||
* restored save state cannot leave the compiled instruction stale.
|
||||
*/
|
||||
void psx_mod_write_code_word(uint32_t address, uint32_t value);
|
||||
|
||||
/*
|
||||
* Allocate opt-in enhancement memory from Expansion 1. Until the first
|
||||
|
||||
@@ -6007,7 +6007,13 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
#endif
|
||||
{
|
||||
int rui_deadzone_pct = seed.deadzone * 100 / 32767;
|
||||
/*
|
||||
* Round to the nearest launcher percent. Truncation turned a
|
||||
* saved 20% value (6553/32767) into 19%, which the launcher's
|
||||
* 5% normalization then silently reduced to 15%.
|
||||
*/
|
||||
int rui_deadzone_pct =
|
||||
(seed.deadzone * 100 + 32767 / 2) / 32767;
|
||||
ls.deadzone[0] = rui_deadzone_pct;
|
||||
ls.deadzone[1] = rui_deadzone_pct;
|
||||
}
|
||||
|
||||
@@ -1124,6 +1124,11 @@ extern "C" void psx_mod_write_word(uint32_t address, uint32_t value) {
|
||||
psx_write_word(address, value);
|
||||
}
|
||||
|
||||
extern "C" void psx_mod_write_code_word(uint32_t address, uint32_t value) {
|
||||
psx_write_word(address, value);
|
||||
dirty_ram_mark_executable_range(address & 0x1FFFFFFFu, 4u);
|
||||
}
|
||||
|
||||
extern "C" uint32_t psx_mod_alloc_guest_memory(uint32_t size,
|
||||
uint32_t alignment) {
|
||||
return psx_mod_memory_alloc(size, alignment);
|
||||
|
||||
Reference in New Issue
Block a user