Skip to content

Commit

Permalink
Fixed crash, fixed checkpoint GameObject being visible sometimes, upd…
Browse files Browse the repository at this point in the history
…ated pattern, fixed offset
  • Loading branch information
0x5abe committed Jul 2, 2024
1 parent 33b8fab commit 85d5d00
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 10 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.0.1-alpha.3

* Fixed a common crash
* Fixed a bug where the hidden checkpoint would become visible after deleting every checkpoint in practice mode

## v1.0.1-alpha.2

* Fixed incompatibility with Prism Menu that caused the Macro Editor to be visible when loading a save
Expand Down
7 changes: 5 additions & 2 deletions docs/PSF.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,12 @@ struct KeyframeObject {
struct GroupCommandObject2 {
u8 m_unk[440];
vector<KeyframeObject> m_unkVecKeyframeObject;
u8 m_unk2[24];
vector<s32> m_unkVecInt;
u8 m_unk2[8];
GameObjectPtr m_gameObject;
padding[4];
u8 m_unk3[8];
vector<s32> m_unkVecInt;
u8 m_unk4[8];
};

struct TimerItem {
Expand Down
15 changes: 10 additions & 5 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
"gd": {
"win": "2.206"
},
"version": "v1.0.1-alpha.2",
"version": "v1.0.1-alpha.3",
"id": "sabe.platformersaves",
"name": "PlatformerSaves",
"developer": "Sabe",
"description": "Save and load your progress in platformer levels!",
"repository": "https://github.com/0x5abe/PlatformerSaves",
"resources": {
"sprites": [
"resources/saveButton.png"
]
},
"spritesheets": {
"sheet": [
"resources/sheet/*.png"
]
},
"sprites": [
"resources/saveButton.png"
]
},
"tags": [
"enhancement",
"gameplay"
Expand Down
Binary file added resources/sheet/blacksquare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/hooks/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void PSPlayLayer::setupHasCompleted() {
m_fields->m_loadingProgress = 0.0f;
m_fields->m_bytesToRead = 0;
m_fields->m_bytesRead = 0;
s_currentPlayLayer = nullptr;
}
}

Expand Down Expand Up @@ -181,6 +182,14 @@ void PSPlayLayer::onQuit() {
PlayLayer::onQuit();
}

void PSPlayLayer::updateVisibility(float i_unkFloat) {
PlayLayer::updateVisibility(i_unkFloat);

for (int i = 0; i < m_fields->m_normalModeCheckpoints->count(); i++) {
static_cast<PSCheckpointObject*>(m_fields->m_normalModeCheckpoints->objectAtIndex(i))->m_physicalCheckpointObject->setOpacity(0);
}
}

// custom methods

void PSPlayLayer::registerCheckpointsAndActivatedCheckpoints() {
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/PlayLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class $modify(PSPlayLayer, PlayLayer) {

$override
void onQuit();

$override
void updateVisibility(float i_unkFloat);

// custom methods

Expand Down
6 changes: 3 additions & 3 deletions src/hooks/PlayLayerLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ void PSPlayLayer::loadCheckpointFromStream() {
PSCheckpointObject* l_checkpoint = reinterpret_cast<PSCheckpointObject*>(CheckpointObject::create());
l_checkpoint->load(m_fields->m_inputStream);

GameObject* l_newPhysicalCPO = GameObject::createWithFrame("square_01_001.png");
GameObject* l_newPhysicalCPO = GameObject::createWithFrame("blackSquare.png"_spr);
CC_SAFE_RETAIN(l_newPhysicalCPO);
l_newPhysicalCPO->m_objectID = 0x2c;
l_newPhysicalCPO->m_objectType = GameObjectType::Decoration;
l_newPhysicalCPO->m_glowSprite = nullptr;
l_newPhysicalCPO->m_unk292 = true; // who knows
l_newPhysicalCPO->m_unk306 = true; // who knows
l_newPhysicalCPO->m_unk3ef = true; // who knows
l_newPhysicalCPO->setOpacity(0);

// TODO FIX THIS OFFSET 0X3D4
// TODO FIX THIS OFFSET was 0x3d4 in 2.204
//int* l_unkField1 = reinterpret_cast<int*>(reinterpret_cast<size_t>(l_newPhysicalCPO)+0x3d4);
//*l_unkField1 = 3;

Expand Down

0 comments on commit 85d5d00

Please sign in to comment.