Skip to content

Commit

Permalink
Prepped for v1.0.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
gurrenm3 committed Jun 28, 2022
1 parent 5911549 commit 3fc1346
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 24 deletions.
9 changes: 2 additions & 7 deletions NoMansSky.Api/Game Classes/Game Stuff/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ public sealed class Game : ReloadedGame, IGame
/// <summary>
/// <inheritdoc/>
/// </summary>
public static Game Instance => _instance;

/// <summary>
/// Backing field for <see cref="Instance"/>.
/// </summary>
private static Game _instance = null!;
public static Game Instance { get; set; }

/// <summary>
/// <inheritdoc/>
Expand Down Expand Up @@ -98,7 +93,7 @@ public Game(IModLogger apiLogger)
/// <returns></returns>
private void Initialize()
{
_instance = this;
Instance = this;
IGame.Instance = this;

//GameLoop = new HookedGameLoop();
Expand Down
1 change: 1 addition & 0 deletions NoMansSky.Api/Game Classes/MBinManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public List<IMBin> GetAllMBIN()
public IMBin GetMbin(string mbinName)
{
mbinName = mbinName.ToLower();

foreach (var mbin in loadedMBIN)
{
var currentMbinName = mbin.Name.ToLower();
Expand Down
9 changes: 6 additions & 3 deletions NoMansSky.Api/Memory/MemoryManagerCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NoMansSky.Api
internal class MemoryManagerCache
{
private Dictionary<string, MemoryInfo> addressCache = new Dictionary<string, MemoryInfo>();
private static IMBinManager MBinManager => Game.Instance?.MBinManager;
private static IMBinManager MBinManager => IGame.Instance?.MBinManager;

public MemoryManagerCache()
{
Expand All @@ -24,18 +24,21 @@ public MemoryInfo GetAddressInfo(string path)
if (addressCache.TryGetValue(path, out var memInfo))
return memInfo;

if (MBinManager == null)
throw new NullReferenceException("Error! MBinManager is null! This is not suppose to happen!");

// create path array.
string[] pathSplit = path.Contains(".") ? path.Split('.') : pathSplit = new string[1] { path };
string mbinName = pathSplit[0];
var mbin = MBinManager?.GetMbin(mbinName);
var mbin = MBinManager.GetMbin(mbinName);
if (mbin == null)
throw new Exception($"Failed to get mbin with the name of \"{mbinName}\"");

var currentType = MBinManager?.GetMbinType(mbinName);
if (currentType == null)
throw new Exception($"Failed to get the type for the mbin with the name of \"{mbinName}\"");

// code below is
// code below is getting offsets from each variable. Haven't checked arrays/lists yet.
long currentAddress = mbin.Address;
for (int i = 1; i < pathSplit.Length; i++)
{
Expand Down
13 changes: 2 additions & 11 deletions NoMansSky.Api/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ public Mod(IModConfig _config, IReloadedHooks _hooks, IModLogger _logger) : base
{
Game.ModsWarning.Disable();
Game.OnMainMenu += OnMainMenu;
/*Game.OnMainMenu += () => GlobalMbinModding();
*/

Game.GameLoop.OnUpdate.Postfix += () =>
{
var deltaTime = GameLoop.Time.DeltaTime;
Logger.WriteLine(deltaTime);
};
}

private void OnMainMenu()
{
playerGlobalsAddress = Game.MBinManager.GetMbin("GcPlayerGlobals").Address;

}


Expand All @@ -59,8 +51,7 @@ public async override void Update()
{
if (Keyboard.IsPressed(Key.UpArrow))
{
var mem = new MemoryManager();
int value = mem.GetValue(0);

}
}

Expand Down
2 changes: 1 addition & 1 deletion NoMansSky.Api/ModConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"ModId": "NoMansSky.Api",
"ModName": "No Man\u0027s Sky API",
"ModAuthor": "Gurrenm3",
"ModVersion": "1.0.2",
"ModVersion": "1.0.3",
"ModDescription": "An API for modding No Man\u0027s Sky",
"ModDll": "NoMansSky.Api.dll",
"ModIcon": "Icon.png",
Expand Down
4 changes: 2 additions & 2 deletions NoMansSky.Api/NoMansSky.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<Description>A C# modding API for No Man's Sky. Built with Reloaded2, a set of extremely powerful modding tools.
The purpose of this library is to help mod makers create incredibly diverse and unique mods that would normally be quite impossible. </Description>
<Authors>Gurrenm3</Authors>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.2</FileVersion>
<AssemblyVersion>1.0.3</AssemblyVersion>
<FileVersion>1.0.3</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 3fc1346

Please sign in to comment.