Don't Display Default Screenshots in Main Menu

Author Topic: Don't Display Default Screenshots in Main Menu  (Read 1056 times)

The default screenshots are fine. But I have been playing this game for a decade or so, and I'm getting tired of looking at them. I just want to look at my own screenshots. So I manually delete the default screenshots. However, the game downloaded them again.

So I made a script that deletes them when the game loads:
Code: [Select]
// Collect list of screenshots to delete.
%deleteList = filePath($Con::File) @ "/toDelete.txt";
%f = new FileObject();
%f.openForRead(%deleteList);
%numShots = 0;
while (!%f.isEOF()) {
%line = %f.readLine();
if (trim(%line) !$= "") {
%delShots[%numShots] = trim(%line);
%numShots++;
}
}
%f.close();
%f.delete();

// Delete screenshots.
for (%i = 0; %i < %numShots; %i++) {
fileDelete("screenshots/" @ %delShots[%i]);
}

But for some reason, this gets the initial loading phase (after the launcher has finished) stuck in a loop.

So I put a delay on the script:
Code: [Select]
// Collect list of screenshots to delete.
function delDefScreenshots() {
%deleteList = filePath($Con::File) @ "/toDelete.txt";
%f = new FileObject();
%f.openForRead(%deleteList);
%numShots = 0;
while (!%f.isEOF()) {
%line = %f.readLine();
if (trim(%line) !$= "") {
%delShots[%numShots] = trim(%line);
%numShots++;
}
}
%f.close();
%f.delete();

// Delete screenshots.
for (%i = 0; %i < %numShots; %i++) {
fileDelete("screenshots/" @ %delShots[%i]);
}
}

schedule(33, 0, "delDefScreenshots");

This solved the problem of the endless loop and successfully deleted the default screenshots. However, the deleted screenshots were replaced with a blank, white screenshot in their place. This is not ideal, and in fact quite an eyesore. I would rather just look at the default screenshots instead.

I tried exporting all the global variables and searching for the screenshot names. But nothing came up. I assume the names of the screenshots are stored within some GUI object. If anyone knows what this object is called, it's name would be much appreciated. Even if I just got the name of the function that initializes the main menu's creation, I could try packaging it and have the screenshots deleted before the list of screenshots is created. Although keeping the screenshots from loading in the first place would be ideal.

The only thread I could find on this topic was this. The thread never reached a solution.

I know Return to Blockland interacts with the main menu (e.g. adding buttons), so I might look there for some answers.

Anyone tried doing this before with any luck? Any suggestions on what else I could try?
« Last Edit: June 12, 2017, 10:03:25 PM by Platypi »

I’d just delete the screenshots and stop using the launcher, the game launches faster too.

If nobody responds with a real solution I’ll look how it works later. My guess would be it has a count and index of screenshots and when you just delete the file it’s still going to try to display it even after being removed.

EDIT: As I suspected, they're stored in mainMenuGui.screenShot[idx]. The value being the path of the image. You could do a loop using mainMenuGui.screenShotCount to locate the default ones and remove them.
« Last Edit: June 10, 2017, 10:03:10 AM by Crøwn »

you could try renaming some of your screenshots to be the defaults and set them to read only

or you can use a batch file to avoid the launcher writing new files instead of making a huge workaround for it

EDIT: As I suspected, they're stored in mainMenuGui.screenShot[idx]. The value being the path of the image. You could do a loop using mainMenuGui.screenShotCount to locate the default ones and remove them.
this is correct, changing these indexes will avoid setting the background images as it loops through each of them (may want to be careful though since it's not made for anyone to just mess with it), you can modify them which is probably the best way if you don't want to use a batch / readonly

or you can use a batch file to avoid the launcher writing new files instead of making a huge workaround for it
pretty sure using a batch file to avoid the launcher doing things is a huge workaround either way

pretty sure using a batch file to avoid the launcher doing things is a huge workaround either way
start Blockland.exe ptlaaxobimwroe
that's really all you need in that batch file inside the bl folder

start Blockland.exe ptlaaxobimwroe
that's really all you need in that batch file inside the bl folder
This worked fine.

As I suspected, they're stored in mainMenuGui.screenShot[idx]. The value being the path of the image. You could do a loop using mainMenuGui.screenShotCount to locate the default ones and remove them.
Thank you, Crøwn! This is what I was looking for. Here's my code:
Code: [Select]
function rmvDefScreenshots() {
// Remove screenshots from screenshot display list.
if (isObject(mainMenuGUI)) {
for (%i = 0; %i <= mainMenuGUI.screenShotCount; %i++) {
%len = strLen(mainMenuGUI.screenShot[%i]);
%screenShot = getSubStr(mainMenuGUI.screenShot[%i], 12, %len);
for (%j = 0; %j < $NDS_numRmvShots; %j++) {
if (%screenShot $= $NDS_rmvShots[%j]) {
for (%k = %i+1; %k <= mainMenuGUI.screenShotCount; %k++) {
mainMenuGUI.screenShot[%k-1] = mainMenuGUI.screenShot[%k];
}
mainMenuGUI.screenShotCount--;
%i--;
break;
}
}
}
}
else {
echo("mainMenuGUI does not exist!");
return 0;
}
return 1;
}

This codes appears to work. I checked mainMenuGUI.dump() to make sure. However, I am now having trouble getting the function to run at the right time. I tried:
Code: [Select]
function tryRmvDefScreenshots() {
echo("Trying to remove default screenshots...");
if (rmvDefScreenshots()) {
echo("Screenshots removed");
}
else {
echo("Failed to remove default screenshots.");
echo("Trying again...");
schedule(500, 0, "tryRmvDefScreenshots");
}
}

tryRmvDefScreenshots();
But this didn't work. I am not sure why exactly. rmvDefScreenshots() executes fine, and I can see "Screenshots removed" in the console log. But mainMenuGui.screenShot[] remains unchanged. Manually running rmvDefScreenshots() fixes it. Grr...
« Last Edit: June 13, 2017, 08:49:58 PM by Platypi »

at the end, try schedule(0, 0, tryRmvDefScreenshots); instead of tryRmvDefScreenshots();

I remember having trouble modifying the main menu BG at game start before, this is what fixed it IIRC.

I made a small adjustment to rmvDefScreenshots(). I changed conditional in the first if statement in the first line (of code) from (isObject(mainMenuGUI)) to (isObject(mainMenuGUI) && mainMenuGUI.screenShotCount > 0). Problem fixed.

However, a default screenshot will occasionally still display as the first image. I tried increasing the delay, but to no avail.