-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (66 loc) · 2.32 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (66 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ------------------------------------------------------------------------- //
// Self-contained SteamStub v3 unpacker By GHFear @ IllusorySoftware //
// Version 0.1.9 //
// Compatible with Emscripten (drop the emsdk folder next to this file and //
// compile with the included compile script for linux) //
// ------------------------------------------------------------------------- //
// Lots of credit to Cyanic (aka Golem_x86), atom0s and illnyang for prior //
// research on steamstub drm. //
// Without y'all, this wouldn't be possible. //
// ------------------------------------------------------------------------- //
#include <cstddef>
#include <cstdint>
#include <emscripten.h>
#include "includes/App/SteamStubApplication.h"
// I might want to compile the application to an executable at some point. Keep main.
int main(int argc, char** argv)
{
return 0;
}
extern "C" {
EMSCRIPTEN_KEEPALIVE
int check_version_information(uint8_t* ptr, size_t size)
{
return SteamStub::Application::instance().checkVersionInformation(ptr, size);
}
EMSCRIPTEN_KEEPALIVE
int unpack_buffer(uint8_t* ptr, size_t size)
{
return SteamStub::Application::instance().unpackBuffer(ptr, size);
}
EMSCRIPTEN_KEEPALIVE
uint8_t* get_unpacked_ptr()
{
return SteamStub::Application::instance().unpackedPtr();
}
EMSCRIPTEN_KEEPALIVE
size_t get_unpacked_size()
{
return SteamStub::Application::instance().unpackedSize();
}
EMSCRIPTEN_KEEPALIVE
uint8_t* get_unpackedDRMP_ptr()
{
return SteamStub::Application::instance().unpackedDRMPPtr();
}
EMSCRIPTEN_KEEPALIVE
size_t get_unpackedDRMP_size()
{
return SteamStub::Application::instance().unpackedDRMPSize();
}
EM_JS(void, open_file_js, (), {
const input = document.createElement('input');
input.type = 'file';
input.onchange = async(e) =>
{
const file = e.target.files && e.target.files[0];
console.log(file.name);
await loadExecutableBuffer(file);
};
});
EMSCRIPTEN_KEEPALIVE
void open_file()
{
open_file_js();
}
}