Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrahim778 committed Nov 21, 2021
1 parent b12278d commit 9c4308a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/user/config_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ int saveCheckBoxState(const char *refID, int val)
int saveSlidebarState(const char *refId, SceFloat32 val)
{
int ret = CONFIG_MGR_OK;
if(ret = preSetup(), ret < 0) return ret;

if(ret = preSetup(), ret < 0)
{
print("preSetup() Failed!\n");
return ret;
}
char key[0x400] = {0};
sce_paf_snprintf(key, 0x400, SLIDEBAR_SAVE_DIR "%s", refId);

print("Saving to: %s\n", key);
ret = writeFloatToFile(key, val);

return ret;
Expand Down
6 changes: 5 additions & 1 deletion src/user/default_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ void defaultCheckBoxSave(const char *refID)
void defaultSliderSave(const char *refID)
{
widgetData *data = currentWidgets.GetNode(refID);
if(data == NULL) return;
if(data == NULL)
{
print("Error cannot find widget!\n");
return;
}
saveSlidebarState(refID, ((ProgressBarTouch *)data->widget)->currentValue);
}

Expand Down
5 changes: 3 additions & 2 deletions src/user/event_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ void QMREventHandler::onGet(SceInt32 eventId, Widget *self, SceInt32, ScePVoid p
{
widgetData *widgetInfo = *(widgetData **)puserData;

if(puserData == NULL || self == NULL || widgetInfo == NULL || widgetInfo->CallbackNum == 0 || widgetInfo->Callbacks == NULL) return;

if(puserData == NULL || self == NULL || widgetInfo == NULL || widgetInfo->CallbackNum == 0 || widgetInfo->Callbacks == NULL)
return;

for (int i = 0; i < widgetInfo->CallbackNum; i++)
{
if(widgetInfo->Callbacks[i].function != NULL && widgetInfo->Callbacks[i].id == eventId)
Expand Down
4 changes: 3 additions & 1 deletion src/user/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int summon(widgetData *data)

if(data->OnLoad != NULL)
data->OnLoad(data->refId);

return;
}

Expand Down Expand Up @@ -169,6 +169,8 @@ SceInt32 QMR::RegisterEventHandler(SceInt32 id, widgetData *dat, ECallback Funct
dat->Callbacks[dat->CallbackNum].userDat = userDat;

dat->CallbackNum++;

print("%s: Assigned callback for function: %p id: 0x%X\n", dat->refId, Function, id);
return 0;
}

Expand Down

0 comments on commit 9c4308a

Please sign in to comment.