mirror of
https://github.com/ARMSX2/ARMSX1.git
synced 2026-08-24 16:53:35 -07:00
Start working on CLI
This commit is contained in:
@@ -3,8 +3,46 @@
|
||||
#include "psx/cpu.h"
|
||||
#include "psx/log.h"
|
||||
|
||||
int main() {
|
||||
log_set_level(LOG_ERROR);
|
||||
#include "getopt.h"
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
int log_level = LOG_WARN;
|
||||
const char* bios_path = "bios/scph1001.bin";
|
||||
|
||||
static struct option long_options[] = {
|
||||
{ "log-level" , required_argument, 0, 'L' },
|
||||
{ "bios" , required_argument, 0, 'B' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
int option_index = 0;
|
||||
|
||||
int c = getopt_long(
|
||||
argc, (char* const*)argv,
|
||||
"L:B:", long_options,
|
||||
&option_index
|
||||
);
|
||||
|
||||
while (c != -1) {
|
||||
switch (c) {
|
||||
case 'L': {
|
||||
log_level = atoi(optarg);
|
||||
} break;
|
||||
|
||||
case 'B': {
|
||||
bios_path = optarg;
|
||||
} break;
|
||||
|
||||
}
|
||||
|
||||
c = getopt_long(
|
||||
argc, (char* const*)argv,
|
||||
"L:B:", long_options,
|
||||
&option_index
|
||||
);
|
||||
}
|
||||
|
||||
log_set_level(log_level);
|
||||
|
||||
psx_bios_t* bios = psx_bios_create();
|
||||
psx_ram_t* ram = psx_ram_create();
|
||||
@@ -48,7 +86,7 @@ int main() {
|
||||
psx_gpu_init(gpu);
|
||||
psx_spu_init(spu);
|
||||
|
||||
psx_bios_load(bios, "scph1001.bin");
|
||||
psx_bios_load(bios, bios_path);
|
||||
|
||||
// CPU creation and init
|
||||
psx_cpu_t* cpu = psx_cpu_create();
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ void psx_bios_load(psx_bios_t* bios, const char* path) {
|
||||
FILE* file = fopen(path, "rb");
|
||||
|
||||
if (!file) {
|
||||
log_error("Couldn't open BIOS file \"%s\", path");
|
||||
log_error("Couldn't open BIOS file \"%s\"", path);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user