Skip to content

Commit 9370171

Browse files
committed
adjust ikarus api to phenix-lib
1 parent 1006d12 commit 9370171

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

game/game/compatibility/ikarus.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include <Tempest/Log>
44

5+
#include <phoenix/vobs/misc.hh>
6+
57
using namespace Tempest;
68

79
enum {
@@ -32,15 +34,15 @@ Ikarus::Ikarus(GameScript& /*owner*/, phoenix::vm& vm) : vm(vm)
3234

3335
// Note: no inline asm
3436
// TODO: Make sure this actually works!
35-
vm.override_function("ASMINT_Push", [](){});
36-
vm.override_function("ASMINT_Pop", [](){});
37+
vm.override_function("ASMINT_Push", [](int){});
38+
vm.override_function("ASMINT_Pop", []() -> int { return 0; });
3739
vm.override_function("ASMINT_MyExternal", [](){});
3840
vm.override_function("ASMINT_CallMyExternal", [](){});
3941
vm.override_function("ASMINT_Init", [](){});
40-
vm.override_function("ASM_Open", [](){});
41-
vm.override_function("ASM_Close", [](){});
42-
vm.override_function("ASM", [](){});
43-
vm.override_function("ASM_Run", [](){});
42+
vm.override_function("ASM_Open", [](int){});
43+
vm.override_function("ASM_Close", []() -> int { return 0; });
44+
vm.override_function("ASM", [](int,int){});
45+
vm.override_function("ASM_Run", [](int){});
4446
vm.override_function("ASM_RunOnce", [](){});
4547

4648
vm.override_function("MEMINT_SetupExceptionHandler", [this](){ mem_setupexceptionhandler(); });
@@ -59,14 +61,14 @@ Ikarus::Ikarus(GameScript& /*owner*/, phoenix::vm& vm) : vm(vm)
5961

6062
// ## Basic zCParser related functions ##
6163
vm.override_function("MEM_GetIntAddress", [this](int val){ return _takeref(val); });
62-
vm.override_function("MEM_PtrToInst", [this](int address){ return mem_ptrtoinst(address); });
63-
vm.override_function("_@", [this](int val){ return _takeref(val); });
64-
vm.override_function("_@s", [this](std::string_view val){ return _takeref_s(val); });
65-
vm.override_function("_@f", [this](float val){ return _takeref_f(val); });
64+
vm.override_function("MEM_PtrToInst", [this](int address) -> auto { return mem_ptrtoinst(address); });
65+
vm.override_function("_@", [this](int val) -> int { return _takeref(val); });
66+
vm.override_function("_@s", [this](std::string_view val) -> int { return _takeref_s(val); });
67+
vm.override_function("_@f", [this](float val) -> int{ return _takeref_f(val); });
6668

6769
// ## Preliminary MEM_Alloc and MEM_Free ##
68-
vm.override_function("MEM_Alloc", [this](int amount){ mem_alloc(amount); });
69-
vm.override_function("MEM_Free", [this](int address){ mem_free(address); });
70+
vm.override_function("MEM_Alloc", [this](int amount ) -> int { return mem_alloc(amount); });
71+
vm.override_function("MEM_Free", [this](int address) { mem_free(address); });
7072

7173

7274
vm.override_function("CALL__stdcall", [this](int address){ call__stdcall(address); });
@@ -150,8 +152,9 @@ void Ikarus::call__stdcall(int address) {
150152
(void)address;
151153
}
152154

153-
int Ikarus::mem_ptrtoinst(int address) {
154-
return address;
155+
std::shared_ptr<phoenix::instance> Ikarus::mem_ptrtoinst(int address) {
156+
//return address;
157+
return nullptr;
155158
}
156159

157160
int Ikarus::_takeref(int val) {

game/game/compatibility/ikarus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Ikarus : public ScriptPlugin {
4444
std::string mem_getcommandline();
4545

4646
// pointers
47-
int mem_ptrtoinst (int address);
47+
std::shared_ptr<phoenix::instance> mem_ptrtoinst(int address);
4848

4949
// ## Basic zCParser related functions ##
5050
int _takeref (int val);

0 commit comments

Comments
 (0)