Remove type from java db

This commit is contained in:
Guus Waals 2025-06-01 22:55:11 +08:00
parent f6d2ec6efb
commit cde5c7c313
4 changed files with 15 additions and 42 deletions

View File

@ -4,11 +4,11 @@
#include <gh_global.h>
extern "C" {
undefined r3_windowUnlockCursor(void); // 004013a0 // r3_windowUnlockCursor
undefined FUN_00401320(void); // 00401320 // FUN_00401320
undefined FUN_00401320(void); // 00401320 // FUN_00401320 // cdecl
undefined r3_windowUnlockCursor(void); // 004013a0 // r3_windowUnlockCursor // cdecl
// 004025e0
long __stdcall r3_windowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
long r3_windowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
long lVar1;

View File

@ -83,12 +83,12 @@ const char* lpDefault_005be370 = "1"; // 005be370
const char* s_SoundOnHD_005be374 = "SoundOnHD"; // 005be374
const char* lpDefault_005be380 = "0"; // 005be380
const char* s_TexturesMem_005be384 = "TexturesMem"; // 005be384
pointer& s_Agp= (pointer&) GH_MEM(0x005be390);
const char* s_Agp = "Agp"; // 005be390
const char* s_Outline_005be394 = "Outline"; // 005be394
const char* s_StaticShadows_005be39c = "StaticShadows"; // 005be39c
const char* s_DynamicShadows_005be3ac = "DynamicShadows"; // 005be3ac
const char* s_TriLinear_005be3bc = "TriLinear"; // 005be3bc
pointer& s_Tnl= (pointer&) GH_MEM(0x005be3c8);
const char* s_Tnl = "TnL"; // 005be3c8
const char* s_TexturesCompressed_005be3cc = "TexturesCompressed"; // 005be3cc
const char* s_GLI_Mode_005be3e0 = "GLI_Mode"; // 005be3e0
const char* g_default_display_mode = "1 - 640 x 480 x 16"; // 005be3ec

View File

@ -88,12 +88,12 @@ extern const char* lpDefault_005be370; // 005be370
extern const char* s_SoundOnHD_005be374; // 005be374
extern const char* lpDefault_005be380; // 005be380
extern const char* s_TexturesMem_005be384; // 005be384
extern pointer& s_Agp; // 005be390
extern const char* s_Agp; // 005be390
extern const char* s_Outline_005be394; // 005be394
extern const char* s_StaticShadows_005be39c; // 005be39c
extern const char* s_DynamicShadows_005be3ac; // 005be3ac
extern const char* s_TriLinear_005be3bc; // 005be3bc
extern pointer& s_Tnl; // 005be3c8
extern const char* s_Tnl; // 005be3c8
extern const char* s_TexturesCompressed_005be3cc; // 005be3cc
extern const char* s_GLI_Mode_005be3e0; // 005be3e0
extern const char* g_default_display_mode; // 005be3ec

View File

@ -122,13 +122,11 @@ public class FunctionDatabase implements AutoCloseable {
public static class GlobalEntry {
public Address address;
public String name;
public String dataType;
public File file;
public GlobalEntry(Address address, String name, String dataType, File file) {
public GlobalEntry(Address address, String name, File file) {
this.address = address;
this.name = name;
this.dataType = dataType;
this.file = file;
}
}
@ -184,7 +182,8 @@ public class FunctionDatabase implements AutoCloseable {
script.println("Connected to database: " + dbFile);
} catch (SQLException e) {
script.println("Error connecting to database: " + e.getMessage());
throw new Exception("Failed to connect to database", e);
// throw new Exception("Failed to connect to database", e);
throw e;
}
}
@ -241,15 +240,15 @@ public class FunctionDatabase implements AutoCloseable {
// Global statements
findByNameGlobals = connection.prepareStatement(
"SELECT filepath, name, address, type FROM Globals WHERE name = ?");
"SELECT filepath, name, address FROM Globals WHERE name = ?");
findByAddressGlobals = connection.prepareStatement(
"SELECT filepath, name, address, type FROM Globals WHERE address = ?");
"SELECT filepath, name, address FROM Globals WHERE address = ?");
insertOrReplaceGlobals = connection.prepareStatement(
"INSERT OR REPLACE INTO Globals (filepath, name, address, type) VALUES (?, ?, ?, ?)");
"INSERT OR REPLACE INTO Globals (filepath, name, address) VALUES (?, ?, ?)");
deleteByFilepathGlobals = connection.prepareStatement(
"DELETE FROM Globals WHERE filepath = ?");
loadAllGlobals = connection.prepareStatement(
"SELECT filepath, name, address, type FROM Globals");
"SELECT filepath, name, address FROM Globals");
}
private void closePreparedStatements() throws SQLException {
@ -353,7 +352,6 @@ public class FunctionDatabase implements AutoCloseable {
filepath TEXT,
name TEXT,
address TEXT,
type TEXT,
PRIMARY KEY (name, filepath)
)""";
@ -456,29 +454,6 @@ public class FunctionDatabase implements AutoCloseable {
}
}
// Helper method to add import entry
public void addImportEntry(FunctionEntry entry) throws Exception {
ensureConnection();
String relativePath = new File(RemanConfig.INSTANCE.outputDir).toPath()
.relativize(entry.file.toPath()).toString().replace('\\', '/');
try {
insertOrReplaceImports.setString(1, relativePath);
insertOrReplaceImports.setString(2, entry.name);
insertOrReplaceImports.setString(3, entry.address.toString());
insertOrReplaceImports.setInt(4, entry.type.getValue());
insertOrReplaceImports.setInt(5, entry.callingConvention.getValue());
insertOrReplaceImports.executeUpdate();
script.println("Added/updated import entry: " + entry.name + " at " + entry.address + " in " + relativePath
+ " (calling convention: " + entry.callingConvention + ")");
} catch (SQLException e) {
script.println("Error adding import entry: " + e.getMessage());
throw new Exception("Failed to add import entry", e);
}
}
// Helper method to remove entry by file path
public void removeEntryAt(String filePath) throws Exception {
ensureConnection();
@ -659,13 +634,12 @@ public class FunctionDatabase implements AutoCloseable {
String filepath = rs.getString("filepath");
String name = rs.getString("name");
String addressStr = rs.getString("address");
String typeStr = rs.getString("type");
if (addressStr != null && !addressStr.isEmpty()) {
Address address = script.getCurrentProgram().getAddressFactory().getAddress(addressStr);
File file = new File(RemanConfig.INSTANCE.outputDir, filepath);
return new GlobalEntry(address, name, typeStr, file);
return new GlobalEntry(address, name, file);
}
return null;
}
@ -725,7 +699,6 @@ public class FunctionDatabase implements AutoCloseable {
insertOrReplaceGlobals.setString(1, filepath);
insertOrReplaceGlobals.setString(2, name);
insertOrReplaceGlobals.setString(3, addressStr);
insertOrReplaceGlobals.setString(4, dataType);
insertOrReplaceGlobals.executeUpdate();
script.println("Added/updated global: " + name + " at " + address + " with type " + dataType);