Free memory after use
This commit is contained in:
@@ -108,6 +108,18 @@ namespace Glitter {
|
||||
const char* _00000001403A8541_patch_data
|
||||
= "\x48\x89\xD9\x48\x8B\xD7\x48\xB8\x00\x00\x00\x00\x00\x00\x00\x80\xFF\xD0\xEB\x3B";
|
||||
|
||||
void Init() {
|
||||
glt_particle_manager_x = new (_operator_new(sizeof(GltParticleManagerX))) GltParticleManagerX;
|
||||
}
|
||||
|
||||
void Free() {
|
||||
if (glt_particle_manager_x) {
|
||||
glt_particle_manager_x->~GltParticleManagerX();
|
||||
_operator_delete(glt_particle_manager_x);
|
||||
glt_particle_manager_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Patch() {
|
||||
uint8_t buf[0x100];
|
||||
|
||||
@@ -143,7 +155,5 @@ namespace Glitter {
|
||||
|
||||
// GltParticleManager
|
||||
WRITE_MEMORY(0x00000001409EB880 + 0x20, uint64_t, (uint64_t)GltParticleManager::Disp);
|
||||
|
||||
glt_particle_manager_x = new (_operator_new(sizeof(GltParticleManagerX))) GltParticleManagerX;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1491,5 +1491,8 @@ namespace Glitter {
|
||||
Buffer*& buffer, GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo);
|
||||
extern void DeleteBuffer(Buffer*& buffer, GLuint& vao, GL::ArrayBuffer& vbo, GL::ElementArrayBuffer& ebo);
|
||||
|
||||
extern void Init();
|
||||
extern void Free();
|
||||
|
||||
extern void Patch();
|
||||
}
|
||||
|
||||
@@ -167,9 +167,20 @@ HOOK(void, FASTCALL, ColorChangeDw__ResetData, 0x00000001402C4130, ColorChangeDw
|
||||
This->ResetData();
|
||||
}
|
||||
|
||||
void color_change_dw_patch() {
|
||||
color_change_dw_textures = new prj::vector<prj::vector<void*>>(); // Added
|
||||
void color_change_dw_init() { // Added
|
||||
if (!color_change_dw_textures)
|
||||
color_change_dw_textures = new (_operator_new(sizeof(prj::vector<prj::vector<void*>>))) prj::vector<prj::vector<void*>>;
|
||||
}
|
||||
|
||||
void color_change_dw_free() { // Added
|
||||
if (color_change_dw_textures) {
|
||||
color_change_dw_textures->~vector();
|
||||
_operator_delete(color_change_dw_textures);
|
||||
color_change_dw_textures = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void color_change_dw_patch() {
|
||||
INSTALL_HOOK(ColorChangeDw__ReloadData);
|
||||
INSTALL_HOOK(ColorChangeDw__Draw);
|
||||
INSTALL_HOOK(ColorChangeDw__ResetData);
|
||||
|
||||
@@ -8,4 +8,7 @@
|
||||
#include "../../KKdLib/default.hpp"
|
||||
#include "../dw.hpp"
|
||||
|
||||
extern void color_change_dw_init();
|
||||
extern void color_change_dw_free();
|
||||
|
||||
extern void color_change_dw_patch();
|
||||
|
||||
@@ -81,13 +81,20 @@ HOOK(int32_t, FASTCALL, data_init, 0x0000000140192FF0) {
|
||||
diva_handle = (size_t)WindowFromDC(wglGetCurrentDC());
|
||||
|
||||
rctx->init();
|
||||
Glitter::Init();
|
||||
sprite_manager_init();
|
||||
pv_game_init();
|
||||
color_change_dw_init();
|
||||
rob_osage_test_init();
|
||||
return ret;
|
||||
}
|
||||
|
||||
HOOK(int32_t, FASTCALL, data_free, 0x000000140192490) {
|
||||
rob_osage_test_free();
|
||||
color_change_dw_free();
|
||||
pv_game_free();
|
||||
sprite_manager_free();
|
||||
Glitter::Free();
|
||||
rctx->free();
|
||||
|
||||
int32_t ret = originaldata_free();
|
||||
|
||||
@@ -824,6 +824,27 @@ HOOK(bool, FASTCALL, pv_game_pv_data__load, 0x000000014011B7E0, size_t _this,
|
||||
return false;
|
||||
}
|
||||
|
||||
void pv_game_init() {
|
||||
if (!task_pv_game_x)
|
||||
task_pv_game_x = new (_operator_new(sizeof(TaskPvGameX))) TaskPvGameX;
|
||||
if (!x_pv_game_str_array_ptr)
|
||||
x_pv_game_str_array_ptr = new (_operator_new(sizeof(x_pv_game_str_array))) x_pv_game_str_array;
|
||||
}
|
||||
|
||||
void pv_game_free() {
|
||||
if (x_pv_game_str_array_ptr) {
|
||||
x_pv_game_str_array_ptr->~x_pv_game_str_array();
|
||||
_operator_delete(x_pv_game_str_array_ptr);
|
||||
x_pv_game_str_array_ptr = 0;
|
||||
}
|
||||
|
||||
if (task_pv_game_x) {
|
||||
task_pv_game_x->~TaskPvGameX();
|
||||
_operator_delete(task_pv_game_x);
|
||||
task_pv_game_x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void pv_game_patch() {
|
||||
INSTALL_HOOK(pv_game_load_state_4_tail);
|
||||
INSTALL_HOOK(pv_game_load_state_6_head);
|
||||
@@ -838,9 +859,6 @@ void pv_game_patch() {
|
||||
INSTALL_HOOK(pv_game_pv_data__load);
|
||||
|
||||
WRITE_MEMORY_STRING(0x00000001401027D8, "\x41\x0F\x45\xDF\x75\x2F", 0x06);
|
||||
|
||||
task_pv_game_x = new (_operator_new(sizeof(TaskPvGameX))) TaskPvGameX;
|
||||
x_pv_game_str_array_ptr = new (_operator_new(sizeof(x_pv_game_str_array))) x_pv_game_str_array;
|
||||
}
|
||||
|
||||
bool x_pv_bar_beat_data::compare_bar_time_less(float_t time) {
|
||||
|
||||
@@ -7,4 +7,7 @@
|
||||
|
||||
#include "../../KKdLib/default.hpp"
|
||||
|
||||
extern void pv_game_init();
|
||||
extern void pv_game_free();
|
||||
|
||||
extern void pv_game_patch();
|
||||
|
||||
Reference in New Issue
Block a user