Fix build errors

This commit is contained in:
libretroadmin 2022-07-25 13:11:28 +02:00
parent dc3d11af96
commit 13b58dfd84

View File

@ -1,6 +1,6 @@
#include <stdint.h>
#include <cstring>
#include <string>
#include <memory>
#include "bootloader.h"
@ -14,7 +14,7 @@ void Bootloader::patch_gbc_to_gba_mode() {
/*moves one jump over another and puts ld b,0x01 into the original position*/
uint16_t patchloc = 0xF2;
uint8_t patch[0x7] = {0xCD,0xD0,0x05/*<-call systemsetup*/,0x06,0x01/*<-ld b,0x1*/,0x00/*<-nop*/,0x00/*<-nop*/};
memcpy(bootromswapspace + patchloc, patch, 0x7);
std::memcpy(bootromswapspace + patchloc, patch, 0x7);
}
void Bootloader::load(bool isgbc, bool isgba) {
@ -42,14 +42,14 @@ void Bootloader::load(bool isgbc, bool isgba) {
patch_gbc_to_gba_mode();
//backup rom segment that is shared with bootloader
memcpy(rombackup, (uint8_t*)addrspace_start, bootloadersize);
std::memcpy(rombackup, (uint8_t*)addrspace_start, bootloadersize);
//put back cartridge data in a 256 byte window of the bios that is not mapped(GBC only)
if (isgbc)
memcpy(bootromswapspace + 0x100, rombackup + 0x100, 0x100);
std::memcpy(bootromswapspace + 0x100, rombackup + 0x100, 0x100);
//put bootloader in main memory
memcpy((uint8_t*)addrspace_start, bootromswapspace, bootloadersize);
std::memcpy((uint8_t*)addrspace_start, bootromswapspace, bootloadersize);
using_bootloader = true;
}
@ -89,14 +89,14 @@ void Bootloader::choosebank(bool inbootloader) {
void Bootloader::call_FF50() {
if (!has_called_FF50 && using_bootloader) {
//put rom back in main memory when bootloader has finished
memcpy((uint8_t*)addrspace_start, rombackup, bootloadersize);
std::memcpy((uint8_t*)addrspace_start, rombackup, bootloadersize);
has_called_FF50 = true;
}
}
//this is a developer function only,a real gameboy can never undo calling 0xFF50,this function is for savestate functionality
void Bootloader::uncall_FF50() {
memcpy((uint8_t*)addrspace_start, bootromswapspace, bootloadersize);
std::memcpy((uint8_t*)addrspace_start, bootromswapspace, bootloadersize);
has_called_FF50 = false;
}