Skip to content

Commit

Permalink
MethodEntry -> MethodExport
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentHammerHUN committed Jul 31, 2019
1 parent 6f70f88 commit c82b9a6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Rhydon.Core/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Rhydon.Core {
public static class Extensions {
public static byte ReadKoiByte(this BinaryReader reader, MethodEntry sig) {
public static byte ReadKoiByte(this BinaryReader reader, MethodExport sig) {
var b = (byte)(reader.ReadInt64() ^ sig.Key);
reader.BaseStream.Position -= 7;
sig.Key = sig.Key * 7 + b;
Expand Down
12 changes: 6 additions & 6 deletions Rhydon.Core/Parser/KoiHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public KoiHeader(RhydonContext ctx) {

References = new Dictionary<uint, IMemberRef>(refCount);
Strings = new Dictionary<uint, string>(strCount);
Methods = new Dictionary<uint, MethodEntry>(metCount);
Methods = new Dictionary<uint, MethodExport>(metCount);

ReadReferences(ctx, refCount);
ctx.Logger.Success($"Parsed {refCount} references");
Expand Down Expand Up @@ -66,7 +66,7 @@ void ReadStrings(RhydonContext ctx, int count) {
void ReadMethods(RhydonContext ctx, int count) {
for (var i = 0; i < count; i++) {
var id = ctx.ReadCompressedUint();
var export = MethodEntry.Create(ctx);
var export = MethodExport.Create(ctx);

ctx.Logger.Debug($"Methods[{id:D3}]: Offset: 0x{export.Offset:X8} Key: 0x{export.Key:X8}");
Methods[id] = export;
Expand All @@ -77,7 +77,7 @@ void ReadMethods(RhydonContext ctx, int count) {

public readonly Dictionary<uint, IMemberRef> References;
public readonly Dictionary<uint, string> Strings;
public readonly Dictionary<uint, MethodEntry> Methods;
public readonly Dictionary<uint, MethodExport> Methods;

public static uint FromCodedToken(uint codedToken) {
var rid = codedToken >> 3;
Expand All @@ -102,9 +102,9 @@ public static uint FromCodedToken(uint codedToken) {
}
}

public class MethodEntry {
public static MethodEntry Create(RhydonContext ctx) {
var obj = new MethodEntry { Offset = ctx.Reader.ReadUInt32() };
public class MethodExport {
public static MethodExport Create(RhydonContext ctx) {
var obj = new MethodExport() { Offset = ctx.Reader.ReadUInt32() };
if (obj.Offset != 0) {
obj.Key = ctx.Reader.ReadUInt32();
}
Expand Down
2 changes: 1 addition & 1 deletion Rhydon.Core/RhydonContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public byte[] ReadBytes(int len) =>
public uint ReadUInt32() =>
Reader.ReadUInt32();

public byte ReadKoi(MethodEntry export) =>
public byte ReadKoi(MethodExport export) =>
Reader.ReadKoiByte(export);

public uint ReadCompressedUint() =>
Expand Down
6 changes: 3 additions & 3 deletions Rhydon.Emulator/KoiEmulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

namespace Rhydon.Emulator {
public class KoiEmulator {
public KoiEmulator(RhydonContext ctx, MethodEntry export) {
public KoiEmulator(RhydonContext ctx, MethodExport export) {
Context = ctx;
Export = export;
Registers = new object[16];
Ip = export.Offset;
}

public void ExecuteNext() {
public void EmulateNext() {
var reader = Context.Reader;
var code = reader.ReadKoiByte(Export);
reader.ReadKoiByte(Export); //For "key fixup" according Koi source...
Expand All @@ -19,7 +19,7 @@ public void ExecuteNext() {
}

internal readonly RhydonContext Context;
internal readonly MethodEntry Export;
internal readonly MethodExport Export;
internal object[] Registers;
internal uint Ip;
}
Expand Down

0 comments on commit c82b9a6

Please sign in to comment.