Skip to content

Commit 3a94511

Browse files
committed
v1.0.5.0 "General bug fixes & support for latest patch. Retarget to .NET 4.6"
1 parent 33db096 commit 3a94511

File tree

6 files changed

+42
-22
lines changed

6 files changed

+42
-22
lines changed

source/core/DllMain.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
bool sGameReloaded = false;
2+
13
#pragma managed
2-
#include <stdio.h> /* defines FILENAME_MAX */
3-
#define WINDOWS
4-
#include <direct.h>
5-
#define GetCurrentDir _getcwd
6-
#include<iostream>
74

85
// Import C# code base
96
#using "ScriptHookRDRDotNet.netmodule"
@@ -22,7 +19,6 @@ namespace WinForms = System::Windows::Forms;
2219
// There is no version check performed for assemblies without strong names (https://docs.microsoft.com/en-us/dotnet/framework/deployment/how-the-runtime-locates-assemblies)
2320
[assembly:AssemblyKeyFileAttribute("PublicKeyToken.snk")];
2421

25-
bool sGameReloaded = false;
2622

2723
public ref class ScriptHookRDRDotNet
2824
{

source/core/Script.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ void MainLoop()
129129
}
130130
}
131131

132+
private void TextPoolInit()
133+
{
134+
unsafe
135+
{
136+
if (firstTime)
137+
{
138+
for (float i = 0.0f; i < 10.24; i += 0.01f)
139+
{
140+
NativeFunc.Invoke(0x4170B650590B3B00, 0.1f, 0.1f);
141+
NativeFunc.Invoke(0x50A41AD966910F03, 255, 255, 255, 1);
142+
var res = NativeFunc.Invoke(0xFA925AC00EB830B9, 10, "LITERAL_STRING", " ");
143+
NativeFunc.Invoke(0xD79334A4BB99BAD1, *res, i, i);
144+
}
145+
firstTime = false;
146+
}
147+
}
148+
}
149+
132150
/// <summary>
133151
/// Starts execution of this script.
134152
/// </summary>
@@ -137,16 +155,7 @@ public void Start()
137155
thread = new Thread(new ThreadStart(MainLoop));
138156
thread.Start();
139157

140-
unsafe
141-
{
142-
if (firstTime)
143-
{
144-
NativeFunc.Invoke(0x4170B650590B3B00, 0.1f, 0.1f);
145-
var res = NativeFunc.Invoke(0xFA925AC00EB830B9, 10, "LITERAL_STRING", " ");
146-
NativeFunc.Invoke(0xD79334A4BB99BAD1, *res, 0.0f, 0.0f);
147-
firstTime = false;
148-
}
149-
}
158+
TextPoolInit();
150159

151160
Log.Message(Log.Level.Info, "Started script ", Name, ".");
152161
}

source/scripting_v3/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
// Build Number
2929
// Revision
3030
//
31-
[assembly: AssemblyVersion("1.0.4.6")]
32-
[assembly: AssemblyFileVersion("1.0.4.6")]
31+
[assembly: AssemblyVersion("1.0.5.0")]
32+
[assembly: AssemblyFileVersion("1.0.5.0")]

source/scripting_v3/RDR2.UI/Screen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static class Screen
2727
/// <summary>
2828
/// The base width of the screen used for all UI Calculations, unless ScaledDraw is used
2929
/// </summary>
30-
public const float Width = 1280f;
30+
public const float Width = 1920f;
3131
/// <summary>
3232
/// The base height of the screen used for all UI Calculations
3333
/// </summary>
34-
public const float Height = 720f;
34+
public const float Height = 1080f;
3535

3636
/// <summary>
3737
/// Gets the actual screen resolution the game is being rendered at

source/scripting_v3/RDR2/World.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,28 @@ public static Blip CreateBlip(Vector3 position, float radius)
218218

219219
#region Entities
220220

221+
222+
/// <summary>
223+
/// This method is not fully tested. It uses a straight import from ScriptHookRDR2.dll, and if it is returning 0, then it is *probably* a SHRDR2 issue.
224+
/// </summary>
221225
public static Ped[] GetAllPeds()
222226
{
223227
int[] peds = new int[] { };
224228
RDR2DN.NativeMemory.getAllPeds(peds, 150);
225229
return Array.ConvertAll(peds, handle => new Ped(handle));
226230
}
231+
/// <summary>
232+
/// This method is not fully tested. It uses a straight import from ScriptHookRDR2.dll, and if it is returning 0, then it is *probably* a SHRDR2 issue.
233+
/// </summary>
227234
public static Vehicle[] GetAllVehicles()
228235
{
229236
int[] vehs = new int[] { };
230237
RDR2DN.NativeMemory.getAllVehicles(vehs, 150);
231238
return Array.ConvertAll(vehs, handle => new Vehicle(handle));
232239
}
233-
240+
/// <summary>
241+
/// This method is not fully tested. It uses a straight import from ScriptHookRDR2.dll, and if it is returning 0, then it is *probably* a SHRDR2 issue.
242+
/// </summary>
234243
public static Prop[] GetAllProps()
235244
{
236245
int[] objs = new int[] { };
@@ -275,13 +284,19 @@ public static T GetClosest<T>(Vector3 position, params T[] spatials) where T : I
275284
}
276285
return (T)closest;
277286
}
287+
/// <summary>
288+
/// This method is not fully tested. It uses a straight import from ScriptHookRDR2.dll, and if it is returning 0, then it is *probably* a SHRDR2 issue.
289+
/// </summary>
278290
public static Ped GetClosestPed(Vector3 position, float radius)
279291
{
280292
int[] peds = new int[] { };
281293
RDR2DN.NativeMemory.getAllPeds(peds, 150);
282294
Ped[] newPeds = Array.ConvertAll(peds, handle => new Ped(handle));
283295
return GetClosest(position, newPeds);
284296
}
297+
/// <summary>
298+
/// This method is not fully tested. It uses a straight import from ScriptHookRDR2.dll, and if it is returning 0, then it is *probably* a SHRDR2 issue.
299+
/// </summary>
285300
public static Vehicle GetClosestVehicle(Vector3 position, float radius)
286301
{
287302
int[] vehs = new int[] { };

source/scripting_v3/ScriptHookRDRDotNet_API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>RDR2</RootNamespace>
1111
<AssemblyName>ScriptHookRDRNetAPI</AssemblyName>
12-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
</PropertyGroup>

0 commit comments

Comments
 (0)