Upload Files

This commit is contained in:
phikill 2025-06-24 19:21:07 -03:00
parent d440e3e71c
commit a95b98a606
1054 changed files with 265055 additions and 0 deletions

207
src/lpc_launcher/main.c Normal file
View file

@ -0,0 +1,207 @@
/* main.c
copy this crap, it's open source
2025 - OG:Battlegrounds
*/
/*
This is the main executable,
the objective of this project is to recreate/decompile the original pubg lite launcher,
with the aim of being lighter/more portable/and more compatible,
without the need for the .net crap,
this code is being developed to work with Windows XP Service pack 3 and higher , Linux and Macos.
the project is using CEF 2623 b1401 for windows systems, and CEF 2704 b1415 for linux and macos.
This program is focused on opening on your potato, so do not use 3D web elements like css3d, webgl etc,
because this program may be focused on working with coding in software mode, not on gpus
why do you want it to work on windows xp?
for experiments, and also good portability
Note! The original launcher uses CEF 3578 b1870 so some features may not be available.
cef libraries should be c only,
do not include c++ wrappers, they require boring libraries and use __stdcall differently than __cdecl
you can code this program with c++, but do not include the cef c++ libraries.
the code for this program must be written with C 89 or C++ 98,
for compatibility with other compilers, and for readability.
avoid specific compiler calls.
avoid compiler specific syntax
the code will use doxygen, so document the implemented code well
compatible compilers are Open Watcom 1.9, Visual Studio 2019/2022, clang for macos
I won't have access to the mac, so I'll leave that in someone else's hands.
maybe some original launcher implementations don't work on linux and macos,
like hiding the launcher window and leaving an icon in the tray
use or create abstractions so that the code is the same on multiple platforms
The CEF localization files for macOS are messier and uglier,
if you want to use Xcode or Cocoa it will look like this,
if not we will use the manual loading method.
Now an IMPORTANT note,
I put libcef 2623 as libcef_ in the include directory,
and I put libcef 2704 in its place,
in case the program presents any problem,
or some inclusion code for Windows gives problems,
just use a macro and include libcef_ in place of libcef : this feat was done by phikill
*/
#include<windows.h>
#include<libcef/capi/cef_app_capi.h>
#include<libcef/capi/cef_client_capi.h>
#include<libcef/capi/cef_browser_capi.h>
#include<libcef/capi/cef_life_span_handler_capi.h>
#include"display_manager/display_manager.h"
//#include"cef_manager/cef_custom.h"
#include<stdio.h>
int programLoop = 1; // This is the main loop of the program, if you reset it the program will close
LE_Display *progDisplay; // defined structure of the window handler component
int cefInitialized = 0;
// Struct de handler
typedef struct
{
cef_life_span_handler_t handler;
} MyLifeSpanHandler;
typedef struct
{
cef_client_t client;
} MyClient;
MyClient g_client;
MyLifeSpanHandler g_lifeSpanHandler;
// Inicializa o CEF com settings básicos
void init_cef(HINSTANCE hInstance)
{
cef_main_args_t main_args = {0};
cef_settings_t settings = {0};
// CefMainArgs
main_args.instance = hInstance;
// Settings
settings.size = sizeof(settings);
settings.no_sandbox = 1;
settings.multi_threaded_message_loop = 1; // uses the Windows loop
settings.single_process = 1; // required for XP
// Inicializa o CEF
cef_initialize(&main_args, &settings, NULL, NULL);
}
void CEF_CALLBACK on_after_created(struct _cef_life_span_handler_t* self, struct _cef_browser_t* browser)
{
printf("[CEF] Browser created!\n");
}
// Define a vtable da interface
void setup_lifespan_handler()
{
g_lifeSpanHandler.handler.base.size = sizeof(cef_life_span_handler_t);
g_lifeSpanHandler.handler.on_after_created = on_after_created;
}
cef_life_span_handler_t* CEF_CALLBACK get_life_span_handler(struct _cef_client_t* self)
{
return (cef_life_span_handler_t*)&g_lifeSpanHandler;
}
void setup_client()
{
g_client.client.base.size = sizeof(cef_client_t);
g_client.client.get_life_span_handler = get_life_span_handler;
}
void create_browser()
{
//CefWindowHandle hwnd = (HWND)progDisplay->platformHandle;
cef_window_handle_t hwnd = (cef_window_handle_t)progDisplay->platformHandle;
cef_window_info_t window_info = {0};
cef_browser_settings_t browser_settings = {0};
cef_string_utf16_t url = {0};
window_info.parent_window = hwnd;
window_info.style = WS_CHILD | WS_VISIBLE;
window_info.x = 0;
window_info.y = 0;
window_info.width = progDisplay->width;
window_info.height = progDisplay->height;
browser_settings.size = sizeof(cef_browser_settings_t);
cef_string_utf8_to_utf16("http://127.0.0.1/oidc/interaction/login", strlen("http://127.0.0.1/oidc/interaction/login"), &url);
cef_browser_host_create_browser(&window_info,
(cef_client_t*)&g_client,
&url,
&browser_settings,
NULL);
}
void progLoop()
{
if(!cefInitialized)
{
setup_lifespan_handler();
setup_client();
create_browser();
cefInitialized = 1;
}
}
int main()
{
progDisplay = engineCreateDisplay("MainWindow", 417, 670);
init_cef(progDisplay->platformConnection);
engineSetLoop(progDisplay, &programLoop, progLoop);
cef_shutdown();
return 0;
}