Skip to content

Commit

Permalink
renamed scripts to have capital case names and added Has_Version func…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
r-neal-kelly committed Jan 19, 2021
1 parent 55348f8 commit 7395145
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 5 deletions.
Binary file modified SKSE/Plugins/doticu_skypal.dll
Binary file not shown.
Binary file modified Scripts/skypal.pex
Binary file not shown.
Binary file modified Scripts/skypal_bases.pex
Binary file not shown.
Binary file modified Scripts/skypal_references.pex
Binary file not shown.
1 change: 1 addition & 0 deletions Source/Plugins/doticu_skypal/include/doticu_skypal/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace doticu_skypal {

public:
static Bool_t Has_DLL();
static Bool_t Has_Version(Int_t major, Int_t minor, Int_t patch, String_t mode = "==");

public:
static Float_t Microseconds();
Expand Down
2 changes: 1 addition & 1 deletion Source/Plugins/doticu_skypal/src/consts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace doticu_skypal {

const Version_t<u16> Consts_t::Skyrim::Required_Version() { DEFINE_VERSION(u16, 1, 5, 97, 0); }

const Version_t<u16> Consts_t::SKSE::Minimum_Version() { DEFINE_VERSION(u16, 2, 0, 17, 0); }
const Version_t<u16> Consts_t::SKSE::Minimum_Version() { DEFINE_VERSION(u16, 2, 0, 17); }

const Version_t<u16> Consts_t::Skylib::Current_Version() { DEFINE_VERSION(u16, 1, 0, 0); }

Expand Down
23 changes: 23 additions & 0 deletions Source/Plugins/doticu_skypal/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ namespace doticu_skypal {

STATIC("Has_DLL", false, Bool_t, Has_DLL);

STATIC("Has_Version", false, Bool_t, Has_Version, Int_t, Int_t, Int_t, String_t);

STATIC("Microseconds", false, Float_t, Microseconds);
STATIC("Milliseconds", false, Float_t, Milliseconds);
STATIC("Seconds", false, Float_t, Seconds);
Expand Down Expand Up @@ -148,6 +150,27 @@ namespace doticu_skypal {
return true;
}

Bool_t Main_t::Has_Version(Int_t major, Int_t minor, Int_t patch, String_t mode)
{
Version_t<u16> version(major, minor, patch);

if (CString_t::Is_Same("==", mode, true)) {
return Consts_t::Skylib::Current_Version() == version;
} else if (CString_t::Is_Same("!=", mode, true)) {
return Consts_t::Skylib::Current_Version() != version;
} else if (CString_t::Is_Same("<", mode, true)) {
return Consts_t::Skylib::Current_Version() < version;
} else if (CString_t::Is_Same(">", mode, true)) {
return Consts_t::Skylib::Current_Version() > version;
} else if (CString_t::Is_Same("<=", mode, true)) {
return Consts_t::Skylib::Current_Version() <= version;
} else if (CString_t::Is_Same(">=", mode, true)) {
return Consts_t::Skylib::Current_Version() >= version;
} else {
return Consts_t::Skylib::Current_Version() == version;
}
}

Float_t Main_t::Microseconds()
{
return static_cast<Float_t>(OS_t::Microseconds());
Expand Down
13 changes: 11 additions & 2 deletions Source/Scripts/skypal.psc
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
; Copyright © 2020 r-neal-kelly, aka doticu

Scriptname skypal hidden
Scriptname SkyPal hidden

; Use this to check that the .dll is available
; Use this to check if the user installed the plugin correctly
bool function Has_DLL() native global

; if (mode == "=="): Tests if the dll version matches args exactly
; if (mode == "!="): Tests if the dll version does not match args exactly
; if (mode == "<"): Tests if the dll version is less than args
; if (mode == ">"): Tests if the dll version is greater than args
; if (mode == "<="): Tests if the dll version is less than or equal to args
; if (mode == ">="): Tests if the dll version is greater than or equal to args
; if (mode == invalid): Passes the default mode listed in the signature.
bool function Has_Version(int major, int minor, int patch, string mode = "==") native global

; These can be used for performance timers.
float function Microseconds() native global
float function Milliseconds() native global
Expand Down
2 changes: 1 addition & 1 deletion Source/Scripts/skypal_bases.psc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; Copyright © 2020 r-neal-kelly, aka doticu

Scriptname skypal_bases hidden
Scriptname SkyPal_Bases hidden

;/
Converters:
Expand Down
2 changes: 1 addition & 1 deletion Source/Scripts/skypal_references.psc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; Copyright © 2020 r-neal-kelly, aka doticu

Scriptname skypal_references hidden
Scriptname SkyPal_References hidden

;/
Getters:
Expand Down

0 comments on commit 7395145

Please sign in to comment.