Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: client auto updater #529

Merged
merged 19 commits into from
May 11, 2023
Merged

feat: client auto updater #529

merged 19 commits into from
May 11, 2023

Conversation

conde2
Copy link
Collaborator

@conde2 conde2 commented May 7, 2023

TODO

  • Fix loading and saving settings
  • Fix locales not showing up when first open the client
  • Music is not playing after the updater runs

I had to move the g_resources.init and g_platform.init maybe this caused some bugs?
@mehah i would appreciate some help fixing this bugs.

g_app.restart()
g_logger.info("restart")
--g_app.exit()
-- TODO Restart
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have something like this

void Application::restart()
{
#if not(defined(ANDROID))
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));

    // Create the child process.
    if (CreateProcess((LPCSTR)g_resources.getBinaryName().c_str(), // path to the executable
        nullptr, // command line arguments
        nullptr, // process handle not inheritable
        nullptr, // thread handle not inheritable
        FALSE, // handle inheritance flag
        0, // creation flags
        nullptr, // use parent's environment block
        nullptr, // use parent's starting directory
        &si, // pointer to STARTUPINFO structure
        &pi) // pointer to PROCESS_INFORMATION structure
    ) {
        // Close process and thread handles.
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);
        
    } else {
        g_logger.fatal("Updater restart error. Please restart application");
    }
    quick_exit();
#else
    exit();
#endif
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try and let you know, I still need to figure out how to properly update the .exe file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@conde2 Does this work also for linux/mac executables?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updater or this code from poxis?
The updater should work for mac/linux not sure the if the executable will update, I use windows so not able to test in other systems.

You can try removing the FREE_VERSION and test

void ResourceManager::updateExecutable(std::string fileName)
{
#if defined(ANDROID) || defined(FREE_VERSION)
    g_logger.fatal("Executable cannot be updated on android or in free version");

@dudantas dudantas marked this pull request as draft May 10, 2023 03:46
@dudantas dudantas marked this pull request as draft May 10, 2023 03:46
@poxis
Copy link
Collaborator

poxis commented May 10, 2023

@conde2 try (client.lua) https://pastebin.com/9k69Kftp
so either change the loading order or just use 'scheduleEvent' to wait for everything to load and then open the login or language selection window

the problem is probably here (the client is already run so it won't get this feature)

onRun = startup,

edit:
what the problem is with 'Fix loading and saving settings' ?

edit2:
you can and even need to add to the updater options when there is no given module (folder) then the system creates it because at the moment there is an error such as : Cannot write file: modules/game_newfolder/newfolder.lua

modules/game_newfolder no exist in client

my solution: https://pastebin.com/fAj6tShd

@conde2
Copy link
Collaborator Author

conde2 commented May 10, 2023

@conde2 try (client.lua) https://pastebin.com/9k69Kftp so either change the loading order or just use 'scheduleEvent' to wait for everything to load and then open the login or language selection window

the problem is probably here (the client is already run so it won't get this feature)

onRun = startup,

edit: what the problem is with 'Fix loading and saving settings' ?

edit2: you can and even need to add to the updater options when there is no given module (folder) then the system creates it because at the moment there is an error such as : Cannot write file: modules/game_newfolder/newfolder.lua

modules/game_newfolder no exist in client

my solution: https://pastebin.com/fAj6tShd

Nice catch!
Thanks for pointing me where the problem is, it will be much easier to fix it =)

…oaded modules, fix updater api for empty files
@conde2
Copy link
Collaborator Author

conde2 commented May 10, 2023

@poxis
I fixed the problems you pointed out

There was not problem with loading and saving the settings the problem was that I had a .otml file in 2 places and it loaded from the first and saved on the second one

@conde2 conde2 marked this pull request as ready for review May 11, 2023 02:25
@mehah mehah changed the title Updater feat: client auto updater May 11, 2023
@mehah mehah merged commit 221a2a2 into main May 11, 2023
@mehah mehah deleted the Updater branch May 11, 2023 14:38
@conde2 conde2 restored the Updater branch May 13, 2023 20:18
@conde2 conde2 deleted the Updater branch May 13, 2023 20:20
dudantas added a commit that referenced this pull request Nov 17, 2023
Note: condition has been bitwise removed for normal enum as it has maxed out allowed enums due to bit shift.

Added conditions for absorbs and increases.
Added "COMBAT_NEUTRALDAMAGE"

New "Player::getEquippedItems" function that returns only equipped items.

Added the systems:
• Cleave
• Magic shield capacity
• Perfect shot range
• Damage reflection

Added for imbuement info to show up in cyclopedia combat stats and some other stats from cyclopedia.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants