Skip to content

Commit

Permalink
update IdeLoader to 1.2 - fix a bug with IDE not loading if there is …
Browse files Browse the repository at this point in the history
…2dfx section
  • Loading branch information
x87 committed Dec 1, 2022
1 parent 2f65624 commit a3a5fc6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions loaders/IdeLoader/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ rustflags = [
"-C", "link-arg=/OUT:build/IdeLoader64.cleo",
"-L", "../../SDK"
]

[alias]
b = "build --target i686-pc-windows-msvc"
b64 = "build --target x86_64-pc-windows-msvc"
6 changes: 3 additions & 3 deletions loaders/IdeLoader/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions loaders/IdeLoader/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ide-loader"
version = "1.1.0"
version = "1.2.0"
edition = "2021"
authors = ["Seemann <[email protected]>"]

Expand All @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gta-ide-parser = "0.0.3"
gta-ide-parser = "0.0.4"
ctor = "0.1.21"
serde_json = { version = "1.0", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
5 changes: 3 additions & 2 deletions loaders/IdeLoader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use std::{fs::read_to_string, path::Path};

#[cfg_attr(target_arch = "x86", link(name = "cleo_redux"))]
#[cfg_attr(target_arch = "x86_64", link(name = "cleo_redux64"))]
extern "C" {}

#[ctor]
fn init() {
cleo_redux_sdk::log("IDE Loader 1.1");
cleo_redux_sdk::log("IDE Loader 1.2");
cleo_redux_sdk::register_loader("*.ide", loader);
}

Expand All @@ -17,7 +18,7 @@ pub extern "C" fn loader(file_name: *const cleo_redux_sdk::c_char) -> *mut cleo_

fn serialize_file(path: &Path) -> Option<*mut cleo_redux_sdk::c_void> {
let file = read_to_string(path).ok()?;
let parsed = gta_ide_parser::parse(&file)?;
let parsed = gta_ide_parser::parse(&file).ok()?;
let serialized = serde_json::to_string(&parsed).ok()?;
let buffer = cleo_redux_sdk::alloc_mem(serialized.len() + 1); // extra null-terminated byte
unsafe { buffer.copy_from(serialized.as_ptr() as _, serialized.len()) }
Expand Down

0 comments on commit a3a5fc6

Please sign in to comment.