feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)

Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
This commit is contained in:
gamer147
2026-06-05 17:22:20 -04:00
parent 0d9d8acae0
commit 957af3d1ec
1795 changed files with 166536 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Sqlite3Plugin;
public class DBProxy : IDisposable
{
public IntPtr DBHandle { get; private set; }
public string dbPath { get; private set; }
~DBProxy()
{
CloseDB();
}
public DBProxy()
{
dbPath = null;
DBHandle = IntPtr.Zero;
}
public bool Open(string fileName, string vfsName = null)
{
dbPath = fileName;
IntPtr ppDB = IntPtr.Zero;
byte[] bytes = Encoding.UTF8.GetBytes(fileName + "\0");
byte[] zVfs = null;
if (!string.IsNullOrEmpty(vfsName))
{
zVfs = Encoding.UTF8.GetBytes(vfsName + "\0");
}
int num = Sqlite3LibImport.sqlite3_open_v2(bytes, out ppDB, 1, zVfs);
DBHandle = ppDB;
bool num2 = num == 0;
if (num2)
{
Exec("pragma journal_mode=OFF");
Exec("pragma synchronous=0");
Exec("pragma locking_mode=EXCLUSIVE");
return num2;
}
Debug.LogError("sqlite3_open failed: code " + num);
return num2;
}
public bool OpenWritable(string fileName)
{
dbPath = fileName;
IntPtr ppDB = IntPtr.Zero;
bool flag = true;
try
{
int num = Sqlite3LibImport.sqlite3_open(Encoding.UTF8.GetBytes(fileName + "\0"), out ppDB);
DBHandle = ppDB;
flag = num == 0;
if (flag)
{
Exec("pragma journal_mode=MEMORY");
Exec("pragma synchronous=1");
Exec("pragma locking_mode=EXCLUSIVE");
}
else
{
Debug.LogError("sqlite3_open failed: " + num);
}
}
catch (Exception ex)
{
if (ppDB != IntPtr.Zero)
{
Sqlite3LibImport.sqlite3_close(ppDB);
DBHandle = IntPtr.Zero;
}
throw ex;
}
return flag;
}
public bool Begin()
{
return Exec("BEGIN;");
}
public bool Commit()
{
return Exec("COMMIT;");
}
public bool Rollback()
{
return Exec("ROLLBACK;");
}
public bool Vacuum()
{
return Exec("VACUUM;");
}
public virtual void Dispose()
{
CloseDB();
}
protected virtual void Dispose(bool disposing)
{
CloseDB();
}
private void Terminate()
{
CloseDB();
}
public virtual void CloseDB()
{
if (DBHandle != IntPtr.Zero)
{
int num = Sqlite3LibImport.sqlite3_close(DBHandle);
if (num != 0)
{
Debug.LogError("failed to close db at " + dbPath + ": " + num);
}
DBHandle = IntPtr.Zero;
}
}
public bool Exec(string sql)
{
byte[] bytes = Encoding.UTF8.GetBytes(sql + "\0");
IntPtr pzErrMsg;
int num = Sqlite3LibImport.sqlite3_exec(DBHandle, bytes, IntPtr.Zero, IntPtr.Zero, out pzErrMsg);
if (num != 0)
{
string text = ((pzErrMsg == IntPtr.Zero) ? "" : Marshal.PtrToStringAnsi(pzErrMsg));
Debug.LogError($"sqlite3_exec failed (code {num}: {text}) with sql: {sql}");
ResultCode.CheckCorruption(num, text);
}
return num == 0;
}
public Query Query(string sql)
{
return new Query(this, sql);
}
public PreparedQuery PreparedQuery(string sql)
{
return new PreparedQuery(this, sql);
}
}

View File

@@ -0,0 +1,57 @@
using System;
using System.Text;
namespace Sqlite3Plugin;
public class PreparedQuery : Query
{
public PreparedQuery(DBProxy proxy, string sql)
: base(proxy, sql)
{
}
public bool BindText(int idx, string text)
{
byte[] bytes = Encoding.UTF8.GetBytes(text);
int num = Sqlite3LibImport.sqlite3_bind_text(_stmt, idx, bytes, bytes.Length, IntPtr.Zero);
if (num != 0)
{
Debug.LogError($"sqlite3_bind_text error at idx {idx}: code {num}");
ResultCode.CheckCorruption(num);
}
return num == 0;
}
public bool BindInt(int idx, int iValue)
{
int num = Sqlite3LibImport.sqlite3_bind_int(_stmt, idx, iValue);
if (num != 0)
{
Debug.LogError($"sqlite3_bind_int error at idx {idx}: code {num}");
ResultCode.CheckCorruption(num);
}
return num == 0;
}
public bool BindDouble(int idx, double rValue)
{
int num = Sqlite3LibImport.sqlite3_bind_double(_stmt, idx, rValue);
if (num != 0)
{
Debug.LogError($"sqlite3_bind_double error at idx {idx}: code {num}");
ResultCode.CheckCorruption(num);
}
return num == 0;
}
public bool Reset()
{
int num = Sqlite3LibImport.sqlite3_reset(_stmt);
if (num != 0)
{
Debug.LogError($"sqlite3_reset error: code {num}");
ResultCode.CheckCorruption(num);
}
return num == 0;
}
}

View File

@@ -0,0 +1,90 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Sqlite3Plugin;
public class Query : IDisposable
{
protected DBProxy _proxy;
protected IntPtr _stmt = IntPtr.Zero;
public Query(DBProxy proxy, string sql)
{
_Setup(proxy, sql);
}
protected void _Setup(DBProxy proxy, string sql)
{
_proxy = proxy;
byte[] bytes = Encoding.UTF8.GetBytes(sql);
IntPtr ppStmt;
int num = Sqlite3LibImport.sqlite3_prepare_v2(proxy.DBHandle, bytes, bytes.Length, out ppStmt, IntPtr.Zero);
if (num != 0)
{
ResultCode.CheckCorruption(num);
throw new Exception($"sqlite3_prepare_v2 failed(code {num}) with sql: {sql}");
}
_stmt = ppStmt;
}
public virtual void Dispose()
{
if (_stmt != IntPtr.Zero)
{
int num = Sqlite3LibImport.sqlite3_finalize(_stmt);
_stmt = IntPtr.Zero;
if (num != 0)
{
Debug.LogError("sqlite3_finalize error: " + num);
ResultCode.CheckCorruption(num);
}
}
}
public bool Step()
{
int num = Sqlite3LibImport.sqlite3_step(_stmt);
bool num2 = num == 100;
if (!num2)
{
ResultCode.CheckCorruption(num);
}
return num2;
}
public int GetInt(int idx)
{
return Sqlite3LibImport.sqlite3_column_int(_stmt, idx);
}
public double GetDouble(int idx)
{
return Sqlite3LibImport.sqlite3_column_double(_stmt, idx);
}
public string GetText(int idx)
{
return Marshal.PtrToStringAnsi(Sqlite3LibImport.sqlite3_column_text(_stmt, idx));
}
public byte[] GetBlob(int idx)
{
int num = Sqlite3LibImport.sqlite3_column_bytes(_stmt, idx);
if (num == 0)
{
Debug.LogError("null blob at idx: " + idx);
return null;
}
IntPtr source = Sqlite3LibImport.sqlite3_column_blob(_stmt, idx);
byte[] array = new byte[num];
Marshal.Copy(source, array, 0, num);
return array;
}
public bool IsNull(int idx)
{
return Sqlite3LibImport.sqlite3_column_type(_stmt, idx) == 5;
}
}