Update function tables
This commit is contained in:
parent
cd6670d75a
commit
e78eb74060
File diff suppressed because it is too large
Load Diff
@ -62,12 +62,12 @@ namespace scripting
|
||||
static const auto function_table = 0xB153F90;
|
||||
static const auto method_table = 0xB155890;
|
||||
|
||||
if (index < 0x2DF)
|
||||
if (index < 0x320)
|
||||
{
|
||||
return reinterpret_cast<script_function*>(game::base_address + function_table)[index];
|
||||
return reinterpret_cast<script_function*>(game::base_address + function_table)[index - 1];
|
||||
}
|
||||
|
||||
return reinterpret_cast<script_function*>(game::base_address + method_table)[index];
|
||||
return reinterpret_cast<script_function*>(game::base_address + method_table)[index - 0x8000];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
namespace scripting::lua
|
||||
{
|
||||
/*namespace
|
||||
namespace
|
||||
{
|
||||
struct array_value
|
||||
/*struct array_value
|
||||
{
|
||||
int index;
|
||||
script_value value;
|
||||
@ -107,8 +107,37 @@ namespace scripting::lua
|
||||
table[sol::metatable_key] = metatable;
|
||||
|
||||
return {state, table};
|
||||
}*/
|
||||
|
||||
bool is_istring(const sol::lua_value& value)
|
||||
{
|
||||
if (!value.is<std::string>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto str = value.as<std::string>();
|
||||
|
||||
return str[0] == '&';
|
||||
}
|
||||
}*/
|
||||
|
||||
script_value string_to_istring(const sol::lua_value& value)
|
||||
{
|
||||
const auto str = value.as<std::string>().erase(0, 1);
|
||||
const auto string_value = game::SL_GetString(str.data(), 0);
|
||||
|
||||
game::VariableValue variable{};
|
||||
variable.type = game::SCRIPT_ISTRING;
|
||||
variable.u.uintValue = string_value;
|
||||
|
||||
const auto _ = gsl::finally([&variable]()
|
||||
{
|
||||
game::RemoveRefToValue(variable.type, variable.u);
|
||||
});
|
||||
|
||||
return script_value(variable);
|
||||
}
|
||||
}
|
||||
|
||||
script_value convert(const sol::lua_value& value)
|
||||
{
|
||||
@ -137,6 +166,11 @@ namespace scripting::lua
|
||||
return {value.as<float>()};
|
||||
}
|
||||
|
||||
if (is_istring(value))
|
||||
{
|
||||
return string_to_istring(value);
|
||||
}
|
||||
|
||||
if (value.is<std::string>())
|
||||
{
|
||||
return {value.as<std::string>()};
|
||||
|
Loading…
Reference in New Issue
Block a user