Example #1
0
int32_t __stdcall IsBreakpoint(EMUHANDLE handle, uint32_t pos)
{
	Gameboy *emulator = (Gameboy *) handle;
	if (handle == NULL || emulator->GetMem() == NULL)
		return 1 == 0;
	uint32_t unbankedAddress = emulator->GetMem()->GetUnbankedAddress(pos);
	return emulator->IsBreakpoint(unbankedAddress);
}
Example #2
0
uint8_t __stdcall GetMemoryData(EMUHANDLE handle, int32_t memory, uint32_t address)
{
	Gameboy *emulator = (Gameboy *) handle;
	if (handle == NULL)
		return 0;
	switch (memory)
	{
	case 100: // Address space
		return emulator->GetMem()->read(address);
	case 101: // ROM
		return emulator->GetMem()->GetROMData(address);
	case 102: // ERAM
		return emulator->GetMem()->GetERAMData(address);
	case 103: // WRAM
		return emulator->GetMem()->GetWRAMData(address);
	case 104: // VRAM
		return emulator->GetMem()->GetVRAMData(address);
	}
	return 0;
}
Example #3
0
uint32_t __stdcall GetValU(EMUHANDLE handle, int32_t id)
{
	Gameboy *emulator = (Gameboy *) handle;
	if (emulator == NULL)
		return 0;
	if (250 <= id && id <= 325)
	{
		return emulator->GetGpu()->GetPalette((id - 250));
	}
	switch (id) // See description XML for ids
	{
	case 10: // AF
		return emulator->GetCpu()->GetRegister(REG_A) | (emulator->GetCpu()->GetRegister(REG_F) << 8);
	case 11: // BC
		return emulator->GetCpu()->GetRegisterPair(REG_BC);
	case 12: // DE
		return emulator->GetCpu()->GetRegisterPair(REG_DE);
	case 13: // HL
		return emulator->GetCpu()->GetRegisterPair(REG_HL);
	case 14: // SP
		return emulator->GetCpu()->GetRegisterPair(REG_SP);
	case 15: // PC
		return emulator->GetCpu()->GetRegisterPair(REG_PC);
	case 16: // Z
		return (emulator->GetCpu()->GetRegister(REG_F) & F_Z) != 0;
	case 17: // N
		return (emulator->GetCpu()->GetRegister(REG_F) & F_N) != 0;
	case 18: // C
		return (emulator->GetCpu()->GetRegister(REG_F) & F_C) != 0;
	case 19: // H
		return (emulator->GetCpu()->GetRegister(REG_F) & F_H) != 0;
	case 21: // halted
		return emulator->GetCpu()->IsHalted();
	case 22: // Stopped
		return emulator->GetCpu()->IsStopped();
	case 20: // IME
		return emulator->GetCpu()->InterruptsEnabled();
	case 110: // Address space
		return 0x10000;
	case 111: // ROM
		return emulator->GetMem()->GetROMSize();
	case 112: // ERAM
		return emulator->GetMem()->GetRAMSize();
	case 113: // WRAM
		return emulator->IsGBC() ? WRAM_BANK_SIZE * 8 : WRAM_BANK_SIZE * 2;
	case 114: // VRAM
		return emulator->IsGBC() ? VRAM_BANK_SIZE * 2 : VRAM_BANK_SIZE;
	case 121: // ROM bank
		return emulator->GetMem()->GetROMBank();
	case 122: // ERAM bank
		return emulator->GetMem()->GetERAMBank();
	case 123: // WRAM bank
		return emulator->GetMem()->GetWRAMBank();
	case 124: // VRAM bank
		return emulator->GetMem()->GetVRAMBank();
	case 200: // LCDC
		return emulator->GetMem()->read(LCDC);
	case 201: // STAT
		return emulator->GetMem()->read(LCDS);
	case 202: // SCX
		return emulator->GetMem()->read(SCX);
	case 203: // SCY
		return emulator->GetMem()->read(SCY);
	case 204: // LY
		return emulator->GetMem()->read(LY);
	case 205: // LYC
		return emulator->GetMem()->read(LYC);
	case 206: // WY
		return emulator->GetMem()->read(WY);
	case 207: // WX
		return emulator->GetMem()->read(WX);
	case 208: // VRAM bank
		return emulator->GetMem()->read(VBK);
	case 209: // enabled
		return emulator->GetGpu()->IsEnabled();
	case 220: // BG grid
		return emulator->GetGpu()->GetBackgroundDebugInfo()->grid;
	case 221: // BG map
		return emulator->GetGpu()->GetBackgroundDebugInfo()->mapMode;
	case 222: // BG data
		return emulator->GetGpu()->GetBackgroundDebugInfo()->dataMode;
	case 223: // BG number
		return emulator->GetGpu()->GetBackgroundDebugInfo()->number;
	case 224: // BG palette
		return emulator->GetGpu()->GetBackgroundDebugInfo()->palette;
	case 225: // BG hflip
		return emulator->GetGpu()->GetBackgroundDebugInfo()->hflip;
	case 226: // BG vflip
		return emulator->GetGpu()->GetBackgroundDebugInfo()->vflip;
	case 227: // BG priority
		return emulator->GetGpu()->GetBackgroundDebugInfo()->priority;
	case 228: // BG mousex
		return emulator->GetGpu()->GetBackgroundDebugInfo()->mouseX;
	case 229: // BG mousey
		return emulator->GetGpu()->GetBackgroundDebugInfo()->mouseY;
	case 230: // Tiles mouseX
		return emulator->GetGpu()->GetTilesDebugInfo()->mouseX;
	case 231: // Tiles mouseY
		return emulator->GetGpu()->GetTilesDebugInfo()->mouseY;
	case 232: // Tiles VRAM
		return emulator->GetGpu()->GetTilesDebugInfo()->vram;
	case 233: // Tiles VRAM
		return emulator->GetGpu()->GetTilesDebugInfo()->address;
	case 234: // Tiles VRAM
		return emulator->GetGpu()->GetTilesDebugInfo()->number;
	case 240: // OAM mousex
		return emulator->GetGpu()->GetOAMDebugInfo()->mouseX;
	case 241: // OAM mousey
		return emulator->GetGpu()->GetOAMDebugInfo()->mouseY;
	case 242: // OAM x
		return emulator->GetGpu()->GetOAMDebugInfo()->x;
	case 243: // OAM y
		return emulator->GetGpu()->GetOAMDebugInfo()->y;
	case 244: // OAM tile
		return emulator->GetGpu()->GetOAMDebugInfo()->tile;
	case 246: // OAM hflip
		return emulator->GetGpu()->GetOAMDebugInfo()->hflip;
	case 247: // OAM vflip
		return emulator->GetGpu()->GetOAMDebugInfo()->vflip;
	case 248: // OAM priority
		return emulator->GetGpu()->GetOAMDebugInfo()->priority;
	case 249: // OAM vram
		return emulator->GetGpu()->GetOAMDebugInfo()->vram;
	default:
		Log(Warn, "Received unknown ID for get value %d", id);
		return 0;
	}
}