Skip to content

Commit a528fa0

Browse files
committed
Version 0.3.0
* libcurl is no longer needed * DllMain now correctly handles directory creation errors * Some improvements to SettingsController * Build script improved + native.globalptr and native.scrbase isimplemented + Experimental GTAV support
1 parent 18cae77 commit a528fa0

33 files changed

+1386
-273
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ jobs:
2929

3030
- name: Download ScriptHookSDK
3131
shell: pwsh
32-
run: .\misc\ScriptHook.ps1
32+
run: |
33+
.\misc\ScriptHook.ps1
34+
.\misc\ScriptHook.ps1 gtav
3335
3436
- name: Detect MSVC
3537
uses: ilammy/msvc-dev-cmd@v1
3638
with:
3739
arch: x86_64
3840

3941
- name: Build plugin
40-
run: .\build.bat
42+
run: |
43+
.\build.bat
44+
.\build.bat gtav
4145
4246
- name: Build release archive
43-
run: |
44-
New-Item -Path ".\objs\output\" -Name "RedLua" -ItemType "directory"
45-
Copy-Item .\LICENSE,.\README.md .\objs\output\
46-
curl.exe -o.\objs\output\RedLua\natives.json https://raw.githubusercontent.com/alloc8or/rdr3-nativedb-data/master/natives.json
47-
7z.exe a -tzip .\objs\out.zip .\objs\output\*.* -r
47+
shell: pwsh
48+
run: .\misc\Pack.ps1
4849

4950
- name: Create release
5051
id: release
@@ -59,12 +60,22 @@ jobs:
5960
draft: false
6061
prerelease: true
6162

62-
- name: Upload assets
63+
- name: Upload assets (RDR2)
6364
uses: actions/upload-release-asset@v1
6465
env:
6566
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6667
with:
6768
upload_url: ${{ steps.release.outputs.upload_url }}
68-
asset_path: .\objs\out.zip
69+
asset_path: .\objs\outRDR2.zip
6970
asset_name: RedLua-${{ github.ref_name }}.zip
7071
asset_content_type: application/zip
72+
73+
- name: Upload assets (GTAV)
74+
uses: actions/upload-release-asset@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
upload_url: ${{ steps.release.outputs.upload_url }}
79+
asset_path: .\objs\outV.zip
80+
asset_name: RedLuaV-${{ github.ref_name }}.zip
81+
asset_content_type: application/zip

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vscode/settings.json
2-
src/thirdparty/ScriptHook/
2+
src/thirdparty/ScriptHookRDR2/
3+
src/thirdparty/ScriptHookV/
34
src/thirdparty/LuaJIT/
45
objs/

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"program": "D:\\LuaJIT\\src\\LuaJIT.exe",
88
"args": ["sl_test.lua"],
99
"stopAtEntry": false,
10-
"cwd": "${workspaceFolder}\\objs\\output\\",
10+
"cwd": "${workspaceFolder}\\objs\\outputRDR2\\",
1111
"environment": [],
1212
"console": "integratedTerminal",
1313
"preLaunchTask": "Build RedLua (Standalone)"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RedLua is a ScriptHookRDR2 library that simplifies the game modding process.
44

55
## Installation
66

7-
Download the latest [release](https://github.com/igor725/RedLua/releases) and extract the archive contents into your game folder. **Note that the RedLua won't work without the [ScriptHookRDR2](https://www.dev-c.com/rdr2/scripthookrdr2/) library!**
7+
Download the latest [release](https://github.com/igor725/RedLua/releases) and extract the archive contents into your game folder (must be writeable). **Note that the RedLua won't work without the [ScriptHookRDR2](https://www.dev-c.com/rdr2/scripthookrdr2/) library!**
88

99
## Usage
1010
Press **F7** (hotkey can be modified in the `Settings.json` file, keycodes can be found [here](https://cherrytree.at/misc/vk.htm)) to open the RedLua menu. Here you can load/reload/stop/unload scripts, reload the NativeDB and change library settings.
@@ -165,7 +165,7 @@ misc.iskeyjustup(VK_*, exclusive = false)
165165
misc.resetkey(VK_*)
166166

167167
-- Get game version
168-
misc.gamever() -- Returns: number, e.g. 1436.31
168+
misc.gamever() -- Returns: number (e.g. 1436.31) and string ("rdr3" or "gta5")
169169

170170
-- Get RedLua version
171171
misc.libver() -- Returns: integer, e.g. 010, 020, etc.
@@ -181,4 +181,4 @@ Thanks to [Mike Pall](https://github.com/LuaJIT/LuaJIT), [Alexander Blade](https
181181

182182
## License
183183

184-
RedLua is released under the MIT License. This license excludes files in the `src\thirdparty` folder that may be distributed under another license. Please read the `LICENSE` file for more information.
184+
RedLua is released under The MIT License. This license excludes files in the `src\thirdparty` that may be distributed under another license. Please read the `LICENSE` file for more information.

build.bat

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ IF NOT "%VSCMD_ARG_TGT_ARCH%"=="x64" (
44
EXIT /B 1
55
)
66
setlocal enableextensions enabledelayedexpansion
7+
SET RL_GTAV=0
8+
SET RL_STANDALONE=0
9+
10+
:argparse
11+
IF "%1"=="gtav" SET RL_GTAV=1
12+
IF "%1"=="standalone" SET RL_STANDALONE=1
13+
IF "%1"=="" GOTO argdone
14+
SHIFT
15+
GOTO argparse
16+
:argdone
717
SET RL_LUAJIT_SOURCE_DIR=.\src\thirdparty\LuaJIT\src
818
IF NOT EXIST "%RL_LUAJIT_SOURCE_DIR%\lua51.lib" (
919
PUSHD %RL_LUAJIT_SOURCE_DIR%
@@ -14,35 +24,46 @@ IF NOT EXIST "%RL_LUAJIT_SOURCE_DIR%\lua51.lib" (
1424
)
1525
POPD
1626
)
17-
SET RL_SCRIPTHOOK_SDK_DIR=.\src\thirdparty\ScriptHook
27+
1828
SET RL_OUT_BIN=RedLua.asi
19-
SET RL_OUT_PATH="D:\SteamLibrary\steamapps\common\Red Dead Redemption 2"
2029
SET RL_LIBS=user32.lib shell32.lib lua51.lib
2130
SET RL_SOURCES=src\*.cpp
2231
SET RL_LDFLAGS=/DLL /INCREMENTAL /LIBPATH:"%RL_LUAJIT_SOURCE_DIR%"
2332
SET RL_CFLAGS=/DELPP_NO_DEFAULT_LOG_FILE /DELPP_DISABLE_LOG_FILE_FROM_ARG ^
2433
/DELPP_THREAD_SAFE /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS /FC /W2 ^
25-
/Isrc\ /EHsc /MP /DLL /Foobjs\
34+
/Isrc\ /EHsc /MP /DLL
35+
36+
IF "%RL_GTAV%"=="1" (
37+
SET RL_OUT_PATH="D:\Games\Grand Theft Auto V"
38+
SET RL_SCRIPTHOOK_VARIANT=V
39+
SET RL_CFLAGS=!RL_CFLAGS! /DREDLUA_GTAV
40+
) ELSE (
41+
SET RL_OUT_PATH="D:\SteamLibrary\steamapps\common\Red Dead Redemption 2"
42+
SET RL_SCRIPTHOOK_VARIANT=RDR2
43+
)
44+
45+
SET RL_SCRIPTHOOK_SDK_DIR=.\src\thirdparty\ScriptHook!RL_SCRIPTHOOK_VARIANT!
2646

27-
IF "%1"=="standalone" (
28-
SET RL_OUT_PATH=".\objs\output"
47+
IF "%RL_STANDALONE%"=="1" (
48+
SET RL_OUT_PATH=".\objs\output!RL_SCRIPTHOOK_VARIANT!"
2949
SET RL_CFLAGS=!RL_CFLAGS! /DREDLUA_STANDALONE /Zi /MTd
3050
SET RL_CFLAGS=!RL_CFLAGS! /Fd!RL_OUT_PATH!\ /DEBUG
3151
SET RL_SOURCES=!RL_SOURCES! src\thirdparty\easyloggingpp.cpp
3252
SET RL_OUT_BIN=RedLua.dll
3353
) ELSE (
3454
SET RL_CFLAGS=!RL_CFLAGS! /MT
35-
SET RL_LIBS=!RL_LIBS! ScriptHookRDR2.lib
55+
SET RL_LIBS=!RL_LIBS! ScriptHook!RL_SCRIPTHOOK_VARIANT!.lib
3656
SET RL_SOURCES=!RL_SOURCES! src\thirdparty\*.cpp src\menus\*.cpp
3757
SET RL_LDFLAGS=!RL_LDFLAGS! /LIBPATH:"!RL_SCRIPTHOOK_SDK_DIR!\lib"
3858
)
3959

40-
MKDIR ".\objs\" 2> NUL
60+
MKDIR ".\objs\!RL_SCRIPTHOOK_VARIANT!" 2> NUL
61+
SET RL_CFLAGS=!RL_CFLAGS! /Foobjs\!RL_SCRIPTHOOK_VARIANT!\
4162
IF NOT EXIST !RL_OUT_PATH! (
42-
SET RL_OUT_PATH=".\objs\output"
63+
SET RL_OUT_PATH=".\objs\output!RL_SCRIPTHOOK_VARIANT!"
4364
MKDIR !RL_OUT_PATH! 2> NUL
4465
)
45-
IF NOT "%1"=="standalone" IF NOT EXIST "!RL_OUT_PATH!\lua51.dll" (
66+
IF NOT "%RL_STANDALONE%"=="1" IF NOT EXIST "!RL_OUT_PATH!\lua51.dll" (
4667
COPY %RL_LUAJIT_SOURCE_DIR%\lua51.dll %RL_OUT_PATH% 2> NUL
4768
)
4869
CL !RL_CFLAGS! /Fe!RL_OUT_PATH!\!RL_OUT_BIN! !RL_SOURCES! /link !RL_LDFLAGS! !RL_LIBS!
56 KB
Binary file not shown.

examples/RCE.lua/Libs/httpcodes.lua

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
return {
2+
[100] = "Continue",
3+
[101] = "Switching Protocols",
4+
[200] = "OK",
5+
[201] = "Created",
6+
[202] = "Accepted",
7+
[203] = "Non-Authoritative Information",
8+
[204] = "No Content",
9+
[205] = "Reset Content",
10+
[206] = "Partial Content",
11+
[300] = "Multiple Choices",
12+
[301] = "Moved Permanently",
13+
[302] = "Found",
14+
[303] = "See Other",
15+
[304] = "Not Modified",
16+
[305] = "Use Proxy",
17+
[307] = "Temporary Redirect",
18+
[400] = "Bad Request",
19+
[401] = "Unauthorized",
20+
[402] = "Payment Required",
21+
[403] = "Forbidden",
22+
[404] = "Not Found",
23+
[405] = "Method Not Allowed",
24+
[406] = "Not Acceptable",
25+
[407] = "Proxy Authentication Required",
26+
[408] = "Request Timeout",
27+
[409] = "Conflict",
28+
[410] = "Gone",
29+
[411] = "Length Required",
30+
[412] = "Precondition Failed",
31+
[413] = "Payload Too Large",
32+
[414] = "URI Too Long",
33+
[415] = "Unsupported Media Type",
34+
[416] = "Range Not Satisfiable",
35+
[417] = "Expectation Failed",
36+
[418] = "I'm a teapot",
37+
[426] = "Upgrade Required",
38+
[500] = "Internal Server Error",
39+
[501] = "Not Implemented",
40+
[502] = "Bad Gateway",
41+
[503] = "Service Unavailable",
42+
[504] = "Gateway Time-out",
43+
[505] = "HTTP Version Not Supported",
44+
[102] = "Processing",
45+
[207] = "Multi-Status",
46+
[226] = "IM Used",
47+
[308] = "Permanent Redirect",
48+
[422] = "Unprocessable Entity",
49+
[423] = "Locked",
50+
[424] = "Failed Dependency",
51+
[428] = "Precondition Required",
52+
[429] = "Too Many Requests",
53+
[431] = "Request Header Fields Too Large",
54+
[451] = "Unavailable For Legal Reasons",
55+
[506] = "Variant Also Negotiates",
56+
[507] = "Insufficient Storage",
57+
[511] = "Network Authentication Required"
58+
}

0 commit comments

Comments
 (0)