Start working on esil stop and halt custom ops

This commit is contained in:
condret 2024-11-15 04:44:29 +01:00
parent 5735df623a
commit 05e4614af4
3 changed files with 32 additions and 2 deletions

View File

@ -1,7 +1,7 @@
LDFLAGS = $(shell pkg-config --libs sdl2 r_util r_io)
CFLAGS = -Wall -I include/ $(shell pkg-config --cflags sdl2 r_util r_io r_arch r_esil r_anal r_reg)
all: sdl/pixbuf.o io/timers.o io/mbc1.o io/mbc2.o io/joypad.o io/dma.o io/ppu.o io/interrupts.o
all: sdl/pixbuf.o io/timers.o io/mbc1.o io/mbc2.o io/joypad.o io/dma.o io/ppu.o io/interrupts.o gb/esil.o
sdl/pixbuf.o:
gcc -c sdl/pixbuf.c -o sdl/pixbuf.o $(CFLAGS)
@ -27,5 +27,8 @@ io/ppu.o:
io/interrupts.o:
gcc -c io/interrupts.c -o io/interrupts.o $(CFLAGS)
gb/esil.o:
gcc -c gb/esil.c -o gb/esil.o $(CFLAGS)
clean:
rm sdl/*.o && rm io/*.o
rm sdl/*.o && rm io/*.o && rm gb/*.o

25
gb/esil.c Normal file
View File

@ -0,0 +1,25 @@
#include <gb.h>
#include <r_esil.h>
bool gb_custom_op_halt (REsil *esil) {
return true;
}
bool gb_custom_op_stop (REsil *esil) {
return true;
}
bool gb_esil_setup (GB *gb) {
if (!gb) {
return false;
}
gb->esil = r_esil_new (4096, 0, 1);
if (!gb->esil) {
return false;
}
r_esil_setup (gb->esil, gb->anal, false, false, false);
gb->esil->user = gb;
r_esil_set_op (gb->esil, "halt", gb_custom_op_halt, 0, 0, R_ESIL_OP_TYPE_CUSTOM);
r_esil_set_op (gb->esil, "stop", gb_custom_op_stop, 0, 0, R_ESIL_OP_TYPE_CUSTOM);
return true;
}

View File

@ -251,4 +251,6 @@ extern RIOPlugin r_io_plugin_gb_mbc1;
extern RIOPlugin r_io_plugin_gb_mbc2;
extern RIOPlugin r_io_plugin_gb_joypad;
bool gb_esil_setup (GB *gb);
#endif