Skip to content

Commit

Permalink
headless linux build for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfloogle committed Apr 21, 2024
1 parent 1b26022 commit c9afa77
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source/common source/arm-linux source/common/inih
SOURCES := source/common source/linux-test source/common/inih
INCLUDES := include source/common/inih

ARCH := -march=armv6 -mfloat-abi=hard

CFLAGS := -Wall -Wno-unused \
-fomit-frame-pointer -ffast-math \
$(ARCH)
Expand All @@ -28,7 +26,7 @@ INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \

CFLAGS += $(INCLUDE)
ASFLAGS := -g $(ARCH)
LIBS := -lm
LIBS := -lm -lminizip -lz

all: slowdebug
release: CFLAGS += -O3 -DDEBUGLEVEL=0
Expand Down
51 changes: 51 additions & 0 deletions source/linux-test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <stdio.h>
#include <unistd.h>
#include "vb_set.h"
#include "v810_cpu.h"
#include "replay.h"

// dummy
#include "vb_dsp.h"
#include "vb_sound.h"
VB_DSPCACHE tDSPCACHE;
void sound_update(uint32_t cycles) {}
void sound_write(int addr, uint16_t val) {}
int drc_handleInterrupts(WORD cpsr, WORD* PC) { return 0; }
void drc_relocTable(void) {}

int main(int argc, char* argv[]) {
int err;

if (argc != 2) {
puts("Pass a ROM please");
return 1;
}

if (access(argv[1], F_OK) != 0) {
printf("Error: ROM %s doesn't exist\n", argv[1]);
return 1;
}

setDefaults();
v810_init();
replay_init();

tVBOpt.ROM_PATH = argv[1];

v810_load_init();
while (true) {
int ret = v810_load_step();
if (ret < 0) return ret;
if (ret == 100) break;
}

while (true) {
err = v810_run();
if (err) {
printf("Error code %d\n", err);
return 1;
}
}

return 0;
}

0 comments on commit c9afa77

Please sign in to comment.