Skip to content

Commit

Permalink
Opcode 0A95 (does not work)
Browse files Browse the repository at this point in the history
  • Loading branch information
RusJJ committed Apr 5, 2024
1 parent a208af6 commit 12a4bb8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cleo4opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ CLEO_Fn(INT_DIV)
cleo->GetPointerToScriptVar(handle)->i = a / b;
}

CLEO_Fn(SAVE_THIS_CUSTOM_SCRIPT)
{
GetAddonInfo(handle).enableThreadSaving = true;
}

CLEO_Fn(GET_PED_POINTER)
{
int ref = cleo->ReadParam(handle)->i;
Expand Down Expand Up @@ -1547,7 +1552,7 @@ void Init4Opcodes()
//CLEO_RegisterOpcode(0x0A92, STREAM_CUSTOM_SCRIPT); //
//CLEO_RegisterOpcode(0x0A93, TERMINATE_THIS_CUSTOM_SCRIPT); //
//CLEO_RegisterOpcode(0x0A94, LOAD_AND_LAUNCH_CUSTOM_MISSION); //
//CLEO_RegisterOpcode(0x0A95, SAVE_THIS_CUSTOM_SCRIPT); //
CLEO_RegisterOpcode(0x0A95, SAVE_THIS_CUSTOM_SCRIPT); // 0A95=0,enable_thread_saving
CLEO_RegisterOpcode(0x0A96, GET_PED_POINTER); // 0A96=2,%2d% = actor %1d% struct
CLEO_RegisterOpcode(0x0A97, GET_VEHICLE_POINTER); // 0A97=2,%2d% = car %1d% struct
CLEO_RegisterOpcode(0x0A98, GET_OBJECT_POINTER); // 0A98=2,%2d% = object %1d% struct
Expand Down
14 changes: 14 additions & 0 deletions cleo5opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ CLEO_Fn(TRACE)
}
CLEO_Fn(LOG_TO_FILE)
{
char to[MAX_STR_LEN];
CLEO_ReadStringEx(handle, to, sizeof(to));
std::string tostr = ResolvePath(handle, to);

bool bTimestamp = cleo->ReadParam(handle)->i;
if(bTimestamp)
{

}

char fmt[MAX_STR_LEN], buf[MAX_STR_LEN];
CLEO_ReadStringEx(handle, fmt, sizeof(fmt));
CLEO_FormatString(handle, buf, sizeof(buf), fmt);

// Need additional work
}

Expand Down
7 changes: 7 additions & 0 deletions cleoaddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <stdint.h>
#include <string.h>
#include <list>

#define CLEO_RegisterOpcode(x, h) cleo->RegisterOpcode(x, h); cleo->RegisterOpcodeFunction(#h, h)
#define CLEO_Fn(h) void h (void *handle, uint32_t *ip, uint16_t opcode, const char *name)
Expand All @@ -12,13 +13,19 @@ struct ScriptAddonInfo
ScriptAddonInfo()
{
workDir.clear();
childThreads.clear();
parentThread = NULL;
scmFuncId = 0;
isCustom = false;
debugMode = false;
enableThreadSaving = false;
}

// GetInterfaceVersion() == 1
std::string workDir;
std::list<void*> childThreads;
void* parentThread;

uint16_t scmFuncId : 10; // [0-1024] - 2^10
uint16_t isCustom : 1; // [0-1]
uint16_t debugMode : 1; // [0-1]
Expand Down

0 comments on commit 12a4bb8

Please sign in to comment.