From 8ae67056c6ecd8649dda40e9615c5ca3bd08eabf Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Sun, 2 May 2021 17:36:17 -0700 Subject: [PATCH] Implement system.CopySaveFile --- src/vm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vm.c b/src/vm.c index 1508cb2..f733434 100644 --- a/src/vm.c +++ b/src/vm.c @@ -27,6 +27,7 @@ #include "system4.h" #include "system4/ain.h" #include "system4/instructions.h" +#include "system4/file.h" #include "system4/string.h" #include "system4/utfsjis.h" @@ -588,6 +589,18 @@ static void system_call(enum syscall_code code) heap_unref(funcname); break; } + case SYS_COPY_SAVE_FILE: { // system.CopySaveFile(string szDestFileName, string szSourceFileName) + int src = stack_pop().i; + int dst = stack_pop().i; + char *u_src = savedir_path(heap[src].s->text); + char *u_dst = savedir_path(heap[dst].s->text); + stack_push(file_copy(u_src, u_dst)); + free(u_src); + free(u_dst); + heap_unref(src); + heap_unref(dst); + break; + } default: VM_ERROR("Unimplemented syscall: 0x%X", code); }