Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8532e6f
binary loading, room getters accept set
namishere Apr 4, 2024
29009a6
auto restart room weight on new game
namishere Apr 4, 2024
6371601
very basic start of content stage loading
namishere Apr 5, 2024
cb30897
progress for now
namishere Apr 5, 2024
a7017bd
stage restore function
namishere Apr 5, 2024
5199ecb
Refine, improve logging, fix string getters
namishere Apr 6, 2024
2b340af
I forgot to provide the logger the string...
namishere Apr 6, 2024
31bad27
Move stage handling to dedicated StageHandler
namishere Apr 7, 2024
e06e9c9
Merge branch 'main' into scatmans-world
namishere Apr 17, 2024
1f89d70
initial prototype
namishere Apr 22, 2024
4e414c2
Expose ResetRoomWeights to lua
namishere Apr 22, 2024
19d42f0
Reset stage state if RoomConfigStage is unloaded
namishere Apr 22, 2024
a38e73f
Fix custom backdrops and Music on custom stages
jsgnextortex Apr 23, 2024
9de9462
StageHandler.AppendBinary
namishere Apr 23, 2024
ccab7b4
Merge branch 'main' into scatmans-world
namishere Apr 26, 2024
9a041fd
Merge branch 'main' into scatmans-world
namishere Apr 26, 2024
34d01c0
why is FXParams::Init not found :(
namishere Apr 26, 2024
609fe5b
change leftover stoi to toint
namishere Apr 26, 2024
4b6fd9b
officially not nothing
namishere Apr 26, 2024
ad1a6da
broke custom backdrop restoration but fxparams works
namishere Apr 26, 2024
0c0d73f
fix base backdrop reloading
namishere Apr 27, 2024
417956f
Merge branch 'main' into scatmans-world
namishere Apr 28, 2024
59c2e2f
attempt to fix heap corruption by allocating RoomSet w/ new
namishere Apr 28, 2024
bf83c2b
lua binders call GetBinary instead of LoadBinary
namishere Apr 29, 2024
23fb6cd
Merge branch 'main' into scatmans-world
namishere Apr 29, 2024
5b72f63
fxlayers parsing changes "stage" param, StageState
namishere Apr 29, 2024
9c3dcff
wip custom stage fxlayers.xml support
namishere Apr 29, 2024
26525e0
fix fxlayers.xml stage param for custom stages
namishere Apr 29, 2024
a1858ea
Fix heap corruption in StageHandler::LoadBinary
Sylmir Apr 29, 2024
efd2f04
custom fxRays: "it's that easy"
namishere Apr 29, 2024
d6e2a03
Merge branch 'main' into scatmans-world
namishere May 20, 2024
ac4fb1f
initial work on StageHandler singleton
namishere May 20, 2024
a36e193
Merge branch 'main' into scatmans-world
namishere Aug 19, 2024
30315c0
bringing back to life
namishere Aug 20, 2024
2868688
replace backdrop handler with old one
namishere Aug 20, 2024
a5be877
add "haswater" option
namishere Aug 20, 2024
e411a23
wip, again
namishere Oct 6, 2024
6f85183
Merge branch 'main' into scatmans-world
namishere Oct 6, 2024
3ba2497
asfsaf
namishere Oct 6, 2024
ce23e9e
initial work on custom stb preservation
namishere Oct 13, 2024
24da02f
filter out vanilla stb filenames
namishere Oct 13, 2024
244d5a2
small optimizations
namishere Oct 13, 2024
b5fc2d4
Merge branch 'main' into scatmans-world
namishere Oct 27, 2024
09c5da3
refactoring
namishere Oct 27, 2024
c93d305
wip nonfunctional stage auto-swap
namishere Oct 28, 2024
2ae8812
stage auto-load first prototype
namishere Oct 28, 2024
6c8e7cf
fix dark home, backwards, depths 2
namishere Oct 29, 2024
a49bef2
fix alt path
namishere Nov 1, 2024
45f5640
Revert "fix alt path"
namishere Nov 4, 2024
0c9bfcf
actually fix alt path (+ flooded caves)
namishere Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,4 @@ include/IsaacRepentance.h
libzhl/IsaacRepentance.cpp
updater/updater.rc
updater_rsrc
updater_rsrc
5 changes: 5 additions & 0 deletions libzhl/functions/ExtraTypes
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ TypeInfo vector_MusicEntry {
Align 4;
};

TypeInfo vector_FXLayers_FX {
Size 12;
Align 4;
};

TypeInfo vector_Curse {
Size 12;
Align 4;
Expand Down
15 changes: 15 additions & 0 deletions libzhl/functions/FXLayers.zhl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"538bdc83ec0883e4f883c404558b6b??896c24??8bec6aff68????????64a1????????50515351b87c020100e8????????a1????????33c58945??5657508d45??64a3????????8965??8bf1":
__thiscall void FXLayers::Init(char * fileName, int levelStage, int stageType);

"558bec53568bf18bda":
static cleanup bool FXLayers::check_fxlayer_match(int stage<ecx>, int altStages<edx>, int compLevelStage, int compStageType);

struct FXLayers depends (Vector, FXParams) {
Vector _averagePlayerPos : 0x0;
bool _loaded : 0x8;
int _levelStage : 0x0c;
int _stageType : 0x10;
int _backdropType : 0x14;
vector_FXLayers_FX _fx : 0x18;
FXParams _fxParams : 0x4f8;
} : 0x584;
15 changes: 15 additions & 0 deletions libzhl/functions/FXLayers_FX.zhl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct FXLayers_FX depends (Vector) {
unsigned int _id : 0x0;
KAGE_Graphics_ImagePNG* _image : 0x4;
// smartpointer 0x8
Vector _min : 0x1c;
Vector _max : 0x24;
unsigned int _layerType : 0x2c;
int _stage : 0x30;
int _altStages : 0x34;
bool _onlyDefaultBackdrop : 0x38;
float _parallax : 0x3c;
int _backdrop : 0x40;
int _blendMode : 0x44;
bool _useBackgroundShader : 0x48;
} : 0x4c;
4 changes: 4 additions & 0 deletions libzhl/functions/Game.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ __thiscall bool Game::GetLevelStateFlag(uint32_t LevelStateFlag);
"568bf18b0d????????8b81????????83f80274??83f80374??8b168d42??83f80577??8b89????????33c081e1000001000bc175??8b46??83f80474??83f80574":
__thiscall bool Game::LevelHasPhotoDoor();

"8b0148":
__thiscall bool Game::IsAscent();

"e8????????c745fcffffffffa3(????????)e8":
reference Game *g_Game;

Expand Down Expand Up @@ -283,6 +286,7 @@ struct Game depends (Level, RoomDescriptor, RoomConfig, BossPool, PlayerManager,
vector_ErasedEntities _erasedEntities : 0x283c14;
bool _triggerWindowResize : 0x1c3154;
unsigned int _gameStateFlags : 0x1c316c;
unsigned int _gameStateFlagsH : 0x1c3170;
int _donationModGreed : 0x1c318c;
int _donationModAngel : 0x1c3190;
float _lightningIntensity : 0x283c00;
Expand Down
1 change: 1 addition & 0 deletions libzhl/functions/Global.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct IntPair {

// When adding typedefs, remember to define them in ExtraTypes!
typedef std::vector<MusicEntry> vector_MusicEntry;
typedef std::vector<FXLayers_FX> vector_FXLayers_FX;
typedef std::vector<SoundEffect> vector_SoundEffect;
typedef std::vector<RoomConfig_Curse> vector_Curse;
typedef std::deque<Point> deque_Point;
Expand Down
3 changes: 3 additions & 0 deletions libzhl/functions/Isaac.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ static __x86_64_output Vector Isaac::GetCollectibleSpawnPosition(Vector* target)
"56578bfa8bf183ffff":
static __x86_64_output Vector Isaac::GetAxisAlignedUnitVectorFromDir(int eDir);

"558bec0f1002":
__fastcall void IsaacRepentance::SwapANM2(ANM2 * left, ANM2 * right);

struct Isaac {
{{
LIBZHL_API static bool IsInGame();
Expand Down
3 changes: 2 additions & 1 deletion libzhl/functions/KAGE_Graphics_Image.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ struct KAGE_Graphics_ImageBase_VertexAttributeDescriptor {
} : 0x8;

struct KAGE_Graphics_ImageBase depends (SourceQuad, DestinationQuad, KAGE_Graphics_Color) {
char* _filepath : 0x3c;
__vtable {
skip; // IsLoaded
skip; // IsProcedural
Expand Down Expand Up @@ -49,7 +50,7 @@ struct KAGE_Graphics_ImageBase depends (SourceQuad, DestinationQuad, KAGE_Graphi
skip; // apply_image
skip; // SetTexelData
};
} : 0;
} : 0x78;

struct KAGE_Graphics_ImagePNG : public KAGE_Graphics_ImageBase {

Expand Down
3 changes: 3 additions & 0 deletions libzhl/functions/Level.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ __thiscall bool Level::IsAltPath();
"558bec83e4f883ec345356576aff":
__thiscall void Level::InitializeDevilAngelRoom(bool ForceAngel, bool ForceDevil);

"558beca1????????83ec0c83b8????????2c":
__thiscall unsigned int Level::GetLocalStageType(int idx);

"558bec6aff68????????64a1????????5083ec24535657a1????????33c5508d45??64a3????????8bd9f30f7e05":
__thiscall int Level::GetRandomRoomIndex(bool IAmErrorRoom, unsigned int Seed);

Expand Down
4 changes: 2 additions & 2 deletions libzhl/functions/RoomConfig.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
__thiscall void RoomConfig::LoadCurses(char* xmlpath,bool ismod);

"558bec8b45??83f8ff75??a1":
static cleanup unsigned int RoomConfig::GetStageID(unsigned int LevelStage<ecx>, unsigned int StageType<edx>, unsigned int Mode);
static cleanup unsigned int RoomConfig::GetStageID(unsigned int LevelStage<ecx>, unsigned int StageType<edx>, int Mode);

"538bdc83ec0883e4f883c404558b6b??896c24??8bec6aff68????????64a1????????50515351b894010100":
__thiscall void RoomConfig::LoadStages(char *xmlpath);

"538bdc83ec0883e4f883c404558b6b??896c24??8bec6aff68????????64a1????????505383ec6c":
__thiscall void RoomConfig::LoadStageBinary(unsigned int Stage, unsigned int Mode);
__thiscall bool RoomConfig::LoadStageBinary(unsigned int Stage, unsigned int Mode);

// RoomConfigHolder

Expand Down
2 changes: 1 addition & 1 deletion libzhl/functions/RoomConfigStage.zhl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ struct RoomConfig_Stage depends (RoomSet) {
RoomSet _rooms[2] : 0x64;
int _musicId : 0xbc;
int _backdrop : 0xc0;
} : 0xc4;
} : 0xc4;
14 changes: 12 additions & 2 deletions libzhl/functions/RoomSet.zhl
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
"558bec6aff68????????64a1????????5083ec085657a1????????33c5508d45??64a3????????8bf9897d??c70700000000c747??00000000c747??0f000000c60700c745??00000000":
__thiscall RoomSet* RoomSet::constructor();

"56578bf98b47??8d77??8bceff70??56e8????????6a18ff36e8????????83c408":
__thiscall void RoomSet::destructor();

"558bec6aff68????????64a1????????5083ec10535657a1????????33c5508d45??64a3????????8bd9895d??8b43??85c0":
__thiscall void RoomSet::unload();

struct RoomSet
{
struct RoomSet {
{{
RoomSet() { constructor(); }
LIBZHL_API ~RoomSet() { destructor(); }
}}
std_string _filepath : 0x0;
RoomConfig_Room* _configs : 0x18;
unsigned int _count : 0x1c;
std_set_int _ids : 0x20;
bool _loaded : 0x28;
} : 0x2c;
8 changes: 7 additions & 1 deletion repentogon/LuaInterfaces/LuaLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ LUA_FUNCTION(Lua_LevelIsAltPath) {
return 1;
}

LUA_FUNCTION(Lua_GetStageId) {
Game* level = lua::GetUserdata<Game*>(L, 1, lua::Metatables::LEVEL, "Level");
lua_pushinteger(L, level->GetStageID(false));
return 1;
}

/*
HOOK_METHOD(Level, IsAltPath, () -> bool) {
bool ret = false;
Expand Down Expand Up @@ -312,8 +318,8 @@ HOOK_METHOD(LuaEngine, RegisterClasses, () -> void) {
{ "GetDimension", Lua_GetDimension},
{ "GetForceSpecialQuest", Lua_GetForceSpecialQuest },
{ "SetForceSpecialQuest", Lua_SetForceSpecialQuest },
{ "GetStageId", Lua_GetStageId },
{ "GetMyosotisPickups", Lua_GetMyosotisPickups },

{ "SetGreedWavesClearedWithoutRedHeartDamage", lua_LevelSetGreedWavesClearedWithoutRedHeartDamage },
{ "GetGreedWavesClearedWithoutRedHeartDamage", lua_LevelGetGreedWavesClearedWithoutRedHeartDamage },

Expand Down
1 change: 0 additions & 1 deletion repentogon/LuaInterfaces/LuaSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ LUA_FUNCTION(Lua_SpriteHasCustomChampionShader)
return 1;
}


// LayerState from here on out

LUA_FUNCTION(Lua_LayerStateSetCustomShader)
Expand Down
33 changes: 25 additions & 8 deletions repentogon/LuaInterfaces/Room/LuaRoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#include "LuaCore.h"
#include "HookSystem.h"
#include "Room.h"
#include "Log.h"

#include "../../Patches/XMLData.h"
#include "../../Patches/CustomItemPools.h"
#include "../../Patches/Stages/StageManager.h"

RoomASM roomASM;
extern uint32_t hookedbackdroptype;
Expand Down Expand Up @@ -379,15 +382,15 @@ LUA_FUNCTION(Lua_RoomGetNumRainSpawners) {

LUA_FUNCTION(Lua_RoomGetBackdropTypeHui) { //this is a bad way to replace room.GetBackdropType, I think
Room* room = lua::GetUserdata<Room*>(L, 1, lua::Metatables::ROOM, lua::metatables::RoomMT);
if (hookedbackdroptype != 0) {
lua_pushinteger(L, hookedbackdroptype);
return 1;
if (XMLStuff.BackdropData->backdropState.first) {
lua_pushinteger(L, XMLStuff.BackdropData->backdropState.second);
}
else {
Backdrop* bg = room->GetBackdrop();
lua_pushinteger(L, bg->backdropId);
return 1;
}

return 1;
}

LUA_FUNCTION(Lua_RoomSaveState) {
Expand Down Expand Up @@ -483,10 +486,24 @@ HOOK_METHOD(Room, Init, (int param_1, RoomDescriptor * desc) -> void) {
roomASM.WaterDisabled = false;
roomASM.ItemPool = POOL_NULL;
super(param_1, desc);
//printf("WaterDisabled is %s, stage is %d\n", roomASM.WaterDisabled ? "TRUE" : "FALSE", g_Game->_stage);
if (g_Game->_stage == 12 && !roomASM.WaterDisabled && (this->_descriptor->Data->StageId == 27 || this->_descriptor->Data->StageId == 28)) {
this->_waterAmount = 1.0f;
//printf("setting water\n");
//ZHL::Log("WaterDisabled is %s, stage is %d\n", roomASM.WaterDisabled ? "TRUE" : "FALSE", g_Game->_stage);
if (!roomASM.WaterDisabled) {
unsigned int stbType = this->_descriptor->Data->StageId;
if (g_Game->_stage == 12 && (stbType == 27 || stbType == 28)) {
this->_waterAmount = 1.0f;
//ZHL::Log("setting water\n");
}
else {
StageManager& stageManager = StageManager::GetInstance();
stbType = RoomConfig::GetStageID(g_Game->_stage, g_Game->_stageType, g_Game->IsGreedMode());
if (stageManager.IsStageOverriden(stbType)) {
XMLAttributes xmlData = XMLStuff.StageData->GetNodeById(stageManager.stageForConfigId[stbType]);
if (tobool(xmlData["haswater"])) {
this->_waterAmount = 1.0f;
//ZHL::Log("setting water\n");
}
}
}
}
}

Expand Down
Loading