Skip to content

Commit

Permalink
Update script with SKSE version check and update DLL
Browse files Browse the repository at this point in the history
In addition to DLL changes, the MenuScript was updated to version check SKSE.
  • Loading branch information
SSyl committed Nov 25, 2019
1 parent 4015c48 commit 4c68999
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 18 deletions.
6 changes: 3 additions & 3 deletions DLL Source/J42_ARR_plugin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
<ProjectGuid>{0091BF4A-C88C-4BB2-A429-3DF4F43C8232}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>J42_ARR_plugin</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>No</UseIntelMKL>
<UseILP64Interfaces>false</UseILP64Interfaces>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>No</UseIntelMKL>
Expand Down
12 changes: 10 additions & 2 deletions DLL Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,18 @@ const UInt8 kDamageResistInject2Bytes[] = {
0xc0, 0x44, 0x0f, 0x2f, 0xc1, 0x72, 0x04, 0x44, 0x0f, 0x28, 0xc1
};
*/
/* Version 1.5.80
const RelocAddr<uintptr_t> kDamageResistInject2Address(0x00624FA2);
const UInt8 kDamageResistInject2Bytes[] = {
0xf3, 0x0f, 0x10, 0x0d, 0x32, 0xd0, 0xf1, 0x00, 0xf3, 0x44, 0x0f, 0x58,
0xc0, 0x44, 0x0f, 0x2f, 0xc1, 0x72, 0x04, 0x44, 0x0f, 0x28, 0xc1
};
*/
const RelocAddr<uintptr_t> kDamageResistInject2Address(0x00624FA2);
const UInt8 kDamageResistInject2Bytes[] = {
0xf3, 0x0f, 0x10, 0x0d, 0x22, 0xd0, 0xf1, 0x00, 0xf3, 0x44, 0x0f, 0x58,
0xc0, 0x44, 0x0f, 0x2f, 0xc1, 0x72, 0x04, 0x44, 0x0f, 0x28, 0xc1
};

const UInt8 kAsm8Nop = 0x90;
const UInt16 kAsm16Nop = 0x9090;
Expand Down Expand Up @@ -378,7 +385,7 @@ extern "C" {
// populate info structure
info->infoVersion = PluginInfo::kInfoVersion;
info->name = "J42_ARR_plugin";
info->version = 20006;
info->version = 20007;

// store plugin handle so we can identify ourselves later
g_pluginHandle = skse->GetPluginHandle();
Expand All @@ -394,7 +401,8 @@ extern "C" {
//else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_53)
//else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_62)
//else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_73)
else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_80)
//else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_80)
else if (skse->runtimeVersion != RUNTIME_VERSION_1_5_97)
{
_ERROR("Unsupported runtime version %08X.", skse->runtimeVersion);

Expand Down
5 changes: 5 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ Requirements:
--------
Changes:
--------
2.0.7 (SE only)
- Updated for SKSE 2.0.17 / Runtime 1.5.97
- Changed display of Damage Taken text on options screen to percentage instead of decimals.
- Thanks to SSyl for the assistance!

2.0.6 (SE only)
- Updated for SKSE 2.0.16 / Runtime 1.5.80
- Thanks to SSyl for the assistance!
Expand Down
Binary file modified SKSE/Plugins/J42_ARR_plugin.dll
Binary file not shown.
Binary file modified scripts/J42_ARR_MenuScript.pex
Binary file not shown.
51 changes: 38 additions & 13 deletions source/scripts/J42_ARR_MenuScript.psc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,36 @@ string version
string[] modes
string[] formulas

; Supported SKSE64 Version.
Int ARRSKSE64Version = 20017

Int Function GetVersion()
;99999 == 9.99.99
return 20006
return 20007
EndFunction

Event OnInit() ; This event will run once, when the script is initialized
OnGameReload()
EndEvent

Event OnGameReload()
if (SKSE.GetVersionRelease() == 0)
debug.Notification(ModName+": SKSE64 is not running. Mod will not work!")
debug.Trace(self+": SKSE not detected")
return

elseIf (SKSE.GetVersion() * 10000 + SKSE.GetVersionMinor() * 100 + SKSE.GetVersionBeta() != ARRSKSE64Version)
debug.Notification(ModName+": Mod will not work correctly!")
debug.MessageBox("Armor Rating Redux will not work correctly!\nWrong SKSE64 version:" \
+"\nRequired version: " + ARRSKSE64Version/10000+"."+(ARRSKSE64Version/100)%100+"."+ARRSKSE64Version%100 \
+"\nDetected version: "+SKSE.GetVersion()+"."+SKSE.GetVersionMinor()+"."+SKSE.GetVersionBeta())
debug.Trace(self+": Wrong SKSE64 version. Armor Rating Redux will not work correctly! Required version: 2.0.17 Detected version:" + SKSE.GetVersion() + "." + SKSE.GetVersionMinor() + "." + SKSE.GetVersionBeta())

return
endif

EndEvent

Event OnVersionUpdate(Int ver)
version = ver/10000+"."+(ver/100)%100+"."+ver%100
debug.Notification(ModName+": Version "+version)
Expand Down Expand Up @@ -121,18 +146,18 @@ Event OnPageReset(string page)
;right side
SetCursorPosition(1)
AddHeaderOption("$J42_ARR_Title_DamageTaken")
AddSliderOption("$J42_ARR_Info_At_X_AR{"+50+"}",J42_ARR_MainQuest.Calculate(50), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+100+"}",J42_ARR_MainQuest.Calculate(100), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+200+"}",J42_ARR_MainQuest.Calculate(200), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+300+"}",J42_ARR_MainQuest.Calculate(300), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+400+"}",J42_ARR_MainQuest.Calculate(400), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+500+"}",J42_ARR_MainQuest.Calculate(500), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+667+"}",J42_ARR_MainQuest.Calculate(667), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+800+"}",J42_ARR_MainQuest.Calculate(800), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+1000+"}",J42_ARR_MainQuest.Calculate(1000), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+1500+"}",J42_ARR_MainQuest.Calculate(1500), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+2000+"}",J42_ARR_MainQuest.Calculate(2000), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+5000+"}",J42_ARR_MainQuest.Calculate(5000), "{5}", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+50+"}",J42_ARR_MainQuest.Calculate(50)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+100+"}",J42_ARR_MainQuest.Calculate(100)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+200+"}",J42_ARR_MainQuest.Calculate(200)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+300+"}",J42_ARR_MainQuest.Calculate(300)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+400+"}",J42_ARR_MainQuest.Calculate(400)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+500+"}",J42_ARR_MainQuest.Calculate(500)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+667+"}",J42_ARR_MainQuest.Calculate(667)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+800+"}",J42_ARR_MainQuest.Calculate(800)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+1000+"}",J42_ARR_MainQuest.Calculate(1000)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+1500+"}",J42_ARR_MainQuest.Calculate(1500)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+2000+"}",J42_ARR_MainQuest.Calculate(2000)*100, "{2}%", OPTION_FLAG_DISABLED)
AddSliderOption("$J42_ARR_Info_At_X_AR{"+5000+"}",J42_ARR_MainQuest.Calculate(5000)*100, "{2}%", OPTION_FLAG_DISABLED)
Endif

EndEvent
Expand Down

0 comments on commit 4c68999

Please sign in to comment.