Clean ptr and fix (#610)

* use more unique ptr and fix a shell crash

* remove useless mods folder

* add even more unique_ptr

* Update KoopaTroopaBeach.cpp

* restore a throw

* Update Game.cpp

* automatically create mods folder

* fix oob in external by assuming that all 8 player can make sound

* better texture loading

* add destructor for gameobject

* avoid out of bound in audio sample

* Update FrameInterpolation.cpp

* Update torch
This commit is contained in:
coco875
2025-12-22 22:48:07 +01:00
committed by GitHub
parent 31c2063a61
commit ce92773a60
77 changed files with 179 additions and 46966 deletions
-4
View File
@@ -1,4 +0,0 @@
emcc test.c -o testc.wasm -O3 -s LINKABLE=1 -s EXPORT_ALL=1 -s PURE_WASI=1
mkdir -p ../../build/mods/
rm ../../build/mods/test.wasm
cp testc.wasm ../../build/mods/test.wasm
-36
View File
@@ -1,36 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#define IMPORT_FUNC(return_type, name) __attribute__((import_name(#name))) return_type name
IMPORT_FUNC(int, call_extern_function)(char* module, char* function_name, int argc, int* argv);
IMPORT_FUNC(void, hook_render)(void());
IMPORT_FUNC(void, load_debug_font)();
IMPORT_FUNC(void, post_debug_print)();
IMPORT_FUNC(void, debug_print_str2)(int x, int y, char*);
int fib(int n) {
// call_extern_function("test", "testfunc", 0, NULL);
if (n <= 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
void testfunc() {
printf("call testfunc with the function test\n");
}
void some_render() {
load_debug_font();
debug_print_str2(0, 0, "hello");
post_debug_print();
}
void init() {
printf("init test\n");
hook_render(some_render);
}
int main() {
}
-2
View File
@@ -1,2 +0,0 @@
node_modules
package-lock.json
-23
View File
@@ -1,23 +0,0 @@
{
"targets": {
"debug": {
"outFile": "build/debug.wasm",
"textFile": "build/debug.wat",
"sourceMap": true,
"debug": true
},
"release": {
"outFile": "build/release.wasm",
"textFile": "build/release.wat",
"sourceMap": true,
"optimizeLevel": 3,
"shrinkLevel": 0,
"converge": false,
"noAssert": false
}
},
"options": {
"bindings": "esm"
},
"extends": "./node_modules/@assemblyscript/wasi-shim/asconfig.json"
}
-6
View File
@@ -1,6 +0,0 @@
export function fib(n: i32): i32 {
if (n <= 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
-6
View File
@@ -1,6 +0,0 @@
{
"extends": "assemblyscript/std/assembly.json",
"include": [
"./**/*.ts"
]
}
-3
View File
@@ -1,3 +0,0 @@
npm run asbuild
rm ../../build/test.wasm
cp build/release.wasm ../../build/test.wasm
-10
View File
@@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script type="module">
import { add } from "./build/release.js";
document.body.innerText = add(1, 2);
</script>
</head>
<body></body>
</html>
-26
View File
@@ -1,26 +0,0 @@
{
"name": "asc",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "node tests",
"asbuild:debug": "asc assembly/index.ts --target debug",
"asbuild:release": "asc assembly/index.ts --target release",
"asbuild": "npm run asbuild:debug && npm run asbuild:release",
"start": "npx serve ."
},
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@assemblyscript/wasi-shim": "^0.1.0",
"assemblyscript": "^0.27.29"
},
"type": "module",
"exports": {
".": {
"import": "./build/release.js",
"types": "./build/release.d.ts"
}
}
}
-1
View File
@@ -1 +0,0 @@
npm install
-4
View File
@@ -1,4 +0,0 @@
import assert from "assert";
import { add } from "../build/debug.js";
assert.strictEqual(add(1, 2), 3);
console.log("ok");
-3
View File
@@ -1,3 +0,0 @@
python setup.py build_ext --inplace
rm ../../build/test.wasm
cp test.cp311-wasm32_wasip1_threads.wasm ../../build/test.wasm
-39092
View File
File diff suppressed because it is too large Load Diff
-9
View File
@@ -1,9 +0,0 @@
from setuptools import setup
from wasmpy_build import build_ext
from Cython.Build import cythonize
setup(
name='Hello world app',
ext_modules=cythonize("test.py"),
cmdclass={"build_ext": build_ext},
)
-6710
View File
File diff suppressed because it is too large Load Diff
-4
View File
@@ -1,4 +0,0 @@
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
-3
View File
@@ -1,3 +0,0 @@
GOOS=wasip1 GOARCH=wasm tinygo build -o testgo.wasm test.go
rm ../../build/test.wasm
cp testgo.wasm ../../build/test.wasm
-12
View File
@@ -1,12 +0,0 @@
package main
//export fib
func fib(n uint32) uint32 {
if (n <= 1) {
return n
}
return fib(n - 1) + fib(n - 2)
}
// main is required for the `wasip1` target, even if it isn't used.
func main() {}
-3
View File
@@ -1,3 +0,0 @@
~/Documents/bin/javy-x86_64-linux-v3.1.0 build mods/js/test.js -C wit=mods/js/test.wit -C wit-world=index-world -o testjs.wasm
rm build/test.wasm
cp testjs.wasm build/test.wasm
-7
View File
@@ -1,7 +0,0 @@
export function fib(n) { // don't accept argument
if (n <= 1){
return n;
}
return fib(n - 1) + fib(n - 2);
}
-5
View File
@@ -1,5 +0,0 @@
package local:main;
world index-world {
export fib: func();
}
-4
View File
@@ -1,4 +0,0 @@
sudo docker pull ysugimoto/webassembly-lua
sudo docker run --rm -v $PWD:/src ysugimoto/webassembly-lua emcc-lua
rm ../../build/test.wasm
cp testlua.wasm ../../build/test.wasm
-8
View File
@@ -1,8 +0,0 @@
functions:
fib:
return : int
args:
- int
entry_file: test.lua
output_file: testlua.wasm
-6
View File
@@ -1,6 +0,0 @@
function fib(n)
if n <= 1 then
return n
end
return fib(n - 1) + fib(n - 2)
end
-5
View File
@@ -1,5 +0,0 @@
*.byte
*.wat
*.js
*.cmi
*.cmo
-2
View File
@@ -1,2 +0,0 @@
ocamlfind ocamlc -package js_of_ocaml,js_of_ocaml-ppx,js_of_ocaml-lwt -linkpkg -o test.byte test.mli test.ml
wasm_of_ocaml test.byte
-1
View File
@@ -1 +0,0 @@
let rec fib n = if n <= 1 then n else fib (n - 1) + fib (n - 2)
View File
-3
View File
@@ -1,3 +0,0 @@
python3.11 py2wasmtest.py test.py -o testpy.wasm
rm ../../build/test.wasm
cp testpy.wasm ../../build/test.wasm
-6
View File
@@ -1,6 +0,0 @@
import re
import sys
from nuitka.__main__ import py2wasm
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(py2wasm())
-1
View File
@@ -1 +0,0 @@
python3.11 -m pip install py2wasm
-4
View File
@@ -1,4 +0,0 @@
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
-3
View File
@@ -1,3 +0,0 @@
out
*.pyc
__pycache__
-5
View File
@@ -1,5 +0,0 @@
py2many . --cpp=1 --outdir out
echo "#include \"../export.cpp\"" >> out/main.cpp
emcc out/main.cpp -o out/testpython.wasm -O3 -s LINKABLE=1 -s EXPORT_ALL=1 -s PURE_WASI=1
rm ../../build/test.wasm
cp out/testpython.wasm ../../build/test.wasm
-5
View File
@@ -1,5 +0,0 @@
extern "C" {
__attribute__((export_name("fib"))) int exp_fib(int n) {
return fib(n);
}
}
-7
View File
@@ -1,7 +0,0 @@
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
if __name__=="__main__":
pass
-8
View File
@@ -1,8 +0,0 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "08:00"
open-pull-requests-limit: 10
-6
View File
@@ -1,6 +0,0 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log
-69
View File
@@ -1,69 +0,0 @@
language: rust
sudo: false
cache: cargo
matrix:
include:
# Builds with wasm-pack.
- rust: beta
env: RUST_BACKTRACE=1
addons:
firefox: latest
chrome: stable
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
script:
- cargo generate --git . --name testing
# Having a broken Cargo.toml (in that it has curlies in fields) anywhere
# in any of our parent dirs is problematic.
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- wasm-pack build
- wasm-pack test --chrome --firefox --headless
# Builds on nightly.
- rust: nightly
env: RUST_BACKTRACE=1
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- rustup target add wasm32-unknown-unknown
script:
- cargo generate --git . --name testing
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- cargo check
- cargo check --target wasm32-unknown-unknown
- cargo check --no-default-features
- cargo check --target wasm32-unknown-unknown --no-default-features
- cargo check --no-default-features --features console_error_panic_hook
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
- cargo check --no-default-features --features "console_error_panic_hook wee_alloc"
- cargo check --target wasm32-unknown-unknown --no-default-features --features "console_error_panic_hook wee_alloc"
# Builds on beta.
- rust: beta
env: RUST_BACKTRACE=1
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- rustup target add wasm32-unknown-unknown
script:
- cargo generate --git . --name testing
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- cargo check
- cargo check --target wasm32-unknown-unknown
- cargo check --no-default-features
- cargo check --target wasm32-unknown-unknown --no-default-features
- cargo check --no-default-features --features console_error_panic_hook
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
# Note: no enabling the `wee_alloc` feature here because it requires
# nightly for now.
-12
View File
@@ -1,12 +0,0 @@
[package]
name = "python"
version = "0.1.0"
authors = ["coco875 <pereira.jannin@gmail.com>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
[dependencies]
rustpython = { git = "https://github.com/RustPython/RustPython", version = "0.4.0" }
wasi = "0.11"
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2018 coco875 <pereira.jannin@gmail.com>
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-84
View File
@@ -1,84 +0,0 @@
<div align="center">
<h1><code>wasm-pack-template</code></h1>
<strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
<p>
<a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
</p>
<h3>
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
<span> | </span>
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
</h3>
<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
</div>
## About
[**📚 Read this template tutorial! 📚**][template-docs]
This template is designed for compiling Rust libraries into WebAssembly and
publishing the resulting package to NPM.
Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
templates and usages of `wasm-pack`.
[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html
## 🚴 Usage
### 🐑 Use `cargo generate` to Clone this Template
[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)
```
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
cd my-project
```
### 🛠️ Build with `wasm-pack build`
```
wasm-pack build
```
### 🔬 Test in Headless Browsers with `wasm-pack test`
```
wasm-pack test --headless --firefox
```
### 🎁 Publish to NPM with `wasm-pack publish`
```
wasm-pack publish
```
## 🔋 Batteries Included
* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
between WebAssembly and JavaScript.
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
for logging panic messages to the developer console.
* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
-3
View File
@@ -1,3 +0,0 @@
cargo build --target wasm32-wasip1 --lib --release
rm ../../build/test.wasm
cp target/wasm32-wasip1/release/rust.wasm ../../build/test.wasm
-1
View File
@@ -1 +0,0 @@
rustup target add wasm32-wasip1
-29
View File
@@ -1,29 +0,0 @@
use std::env;
use rustpython::vm;
fn main() {
let mut setting: vm::Settings = Default::default();
setting.path_list.push("".to_string());
let inter = vm::Interpreter::without_stdlib(setting);
let ret: vm::PyResult<()> = inter.enter(|vm| {
let scope = vm.new_scope_with_builtins();
let source = r#"print("Hello World from python!")"#;
let code_obj = vm
.compile(source, vm::compiler::Mode::Exec, "<embedded>".to_owned())
.map_err(|err| vm.new_syntax_error(&err, Some(source)))?;
vm.unwrap_pyresult(vm.run_code_obj(code_obj, scope));
Ok(())
});
}
#[no_mangle]
pub fn fib(n: u32) -> u32 {
if n <= 1 {
main();
return n;
}
return fib(n - 1) + fib(n - 2);
}
-13
View File
@@ -1,13 +0,0 @@
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
}
-8
View File
@@ -1,8 +0,0 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "08:00"
open-pull-requests-limit: 10
-6
View File
@@ -1,6 +0,0 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log
-69
View File
@@ -1,69 +0,0 @@
language: rust
sudo: false
cache: cargo
matrix:
include:
# Builds with wasm-pack.
- rust: beta
env: RUST_BACKTRACE=1
addons:
firefox: latest
chrome: stable
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
script:
- cargo generate --git . --name testing
# Having a broken Cargo.toml (in that it has curlies in fields) anywhere
# in any of our parent dirs is problematic.
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- wasm-pack build
- wasm-pack test --chrome --firefox --headless
# Builds on nightly.
- rust: nightly
env: RUST_BACKTRACE=1
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- rustup target add wasm32-unknown-unknown
script:
- cargo generate --git . --name testing
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- cargo check
- cargo check --target wasm32-unknown-unknown
- cargo check --no-default-features
- cargo check --target wasm32-unknown-unknown --no-default-features
- cargo check --no-default-features --features console_error_panic_hook
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
- cargo check --no-default-features --features "console_error_panic_hook wee_alloc"
- cargo check --target wasm32-unknown-unknown --no-default-features --features "console_error_panic_hook wee_alloc"
# Builds on beta.
- rust: beta
env: RUST_BACKTRACE=1
before_script:
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
- cargo install-update -a
- rustup target add wasm32-unknown-unknown
script:
- cargo generate --git . --name testing
- mv Cargo.toml Cargo.toml.tmpl
- cd testing
- cargo check
- cargo check --target wasm32-unknown-unknown
- cargo check --no-default-features
- cargo check --target wasm32-unknown-unknown --no-default-features
- cargo check --no-default-features --features console_error_panic_hook
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
# Note: no enabling the `wee_alloc` feature here because it requires
# nightly for now.
-11
View File
@@ -1,11 +0,0 @@
[package]
name = "rust"
version = "0.1.0"
authors = ["coco875 <pereira.jannin@gmail.com>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
[dependencies]
wasi = "0.11"
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2018 coco875 <pereira.jannin@gmail.com>
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-3
View File
@@ -1,3 +0,0 @@
cargo build --target wasm32-wasip1 --release
rm ../../build/test.wasm
cp target/wasm32-wasip1/release/rust.wasm ../../build/test.wasm
-1
View File
@@ -1 +0,0 @@
rustup target add wasm32-wasip1
-7
View File
@@ -1,7 +0,0 @@
#[no_mangle]
pub fn fib(n: u32) -> u32 {
if n <= 1 {
return n;
}
return fib(n - 1) + fib(n - 2);
}
-13
View File
@@ -1,13 +0,0 @@
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
}
+29 -25
View File
@@ -64,7 +64,7 @@ f32 D_800E9EC4[] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800E9ED4[] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800E9EE4[] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800E9EF4[] = { 1.0f, 1.0f, 1.0f, 1.0f };
f32 D_800E9F04[] = { 1.0f, 1.0f, 1.0f, 1.0f };
f32 D_800E9F04[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
f32 D_800E9F14[] = { 1.0f, 1.0f, 1.0f, 1.0f };
u8 D_800E9F24[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8 D_800E9F2C[NUM_PLAYERS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -73,25 +73,29 @@ f32 D_800E9F54[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
u8 D_800E9F74[] = { 0, 0, 0, 0 };
u8 D_800E9F78[] = { 0, 0, 0, 0 };
struct Unk_800E9F7C D_800E9F7C[] = {
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f },
{ { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, 3800.0f, 3.4f, 0.4f, -1.0f, 0.4f, 1100.0f, 630.0f, 3600.0f, 1.0f }
};
struct Unk_800EA06C D_800EA06C[] = { { { 0.0f, 1.0f, 1.0f }, 0 }, { { 0.0f, 1.0f, 1.0f }, 0 },
struct Unk_800EA06C D_800EA06C[NUM_PLAYERS] = { { { 0.0f, 1.0f, 1.0f }, 0 }, { { 0.0f, 1.0f, 1.0f }, 0 },
{ { 0.0f, 1.0f, 1.0f }, 0 }, { { 0.0f, 1.0f, 1.0f }, 0 },
{ { 0.0f, 1.0f, 1.0f }, 0 }, { { 0.0f, 1.0f, 1.0f }, 0 },
{ { 0.0f, 1.0f, 1.0f }, 0 }, { { 0.0f, 1.0f, 1.0f }, 0 } };
u8 D_800EA0EC[] = { 0, 0, 0, 0 };
u8 D_800EA0EC[NUM_PLAYERS] = { 0, 0, 0, 0 };
u8 D_800EA0F0 = 0;
u8 D_800EA0F4 = 0;
UNUSED Vec3f D_800EA0F8 = { 0.0f, 0.0f, 1.0f };
u8 D_800EA104 = 0;
u8 D_800EA108 = 0;
u8 D_800EA10C[] = { 0, 0, 0, 0 };
f32 D_800EA110[] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800EA120[] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800EA130[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
u8 D_800EA10C[NUM_PLAYERS] = { 0, 0, 0, 0 };
f32 D_800EA110[NUM_PLAYERS] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800EA120[NUM_PLAYERS] = { 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800EA130[NUM_PLAYERS] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
f32 D_800EA150 = 1.4f;
u8 D_800EA154[] = { 2, 2, 88, 90, 3, 48, 88, 48 };
u16 gCurrentMusicSeq = 0;
@@ -99,7 +103,7 @@ u16 D_800EA160 = 0;
u8 D_800EA164 = 0;
s8 D_800EA168 = 0;
s8 D_800EA16C = 0;
u8 D_800EA170[] = { 0, 0, 0, 0 };
u8 D_800EA170[NUM_PLAYERS] = { 0, 0, 0, 0 };
u16 D_800EA174 = 0;
f32 D_800EA178 = 1.0f;
f32 D_800EA17C = 0.85f;
@@ -3504,11 +3508,11 @@ void func_800CAD40(UNUSED s32 arg0) {
}
}
void func_800CADD0(u8 arg0, f32 arg1) {
void func_800CADD0(u8 playerId, f32 arg1) {
if (D_800EA108 == 0) {
switch (D_800EA0EC[arg0]) {
switch (D_800EA0EC[playerId]) {
case 2:
D_800EA0EC[arg0] = 1;
D_800EA0EC[playerId] = 1;
// Purposeful fallthrough
case 0:
arg1 = (arg1 * 0.55f) + 0.45f;
@@ -3518,9 +3522,9 @@ void func_800CADD0(u8 arg0, f32 arg1) {
if (arg1 < 0.0f) {
arg1 = 0.0f;
}
D_800EA110[arg0] = arg1;
play_sound(0x1900A209U, &D_800E9F7C[arg0].pos, arg0, &D_800EA1D4, &D_800EA110[arg0],
(u8*) &D_800E9F7C[arg0].unk_14);
D_800EA110[playerId] = arg1;
play_sound(0x1900A209U, &D_800E9F7C[playerId].pos, playerId, &D_800EA1D4, &D_800EA110[playerId],
(u8*) &D_800E9F7C[playerId].unk_14);
break;
default:
break;
@@ -3554,30 +3558,30 @@ void func_800CAEC4(u8 playerId, f32 arg1) {
}
}
void func_800CAFC0(u8 arg0) {
void func_800CAFC0(u8 playerId) {
if (D_800EA108 == 0) {
switch (D_800EA0EC[arg0]) {
switch (D_800EA0EC[playerId]) {
case 2:
D_800EA0EC[arg0] = 1;
D_800EA0EC[playerId] = 1;
case 0:
func_800C36C4(0, 1, 0x55U, 5);
func_800C9060(arg0, 0x19009E59U);
func_800C8F80(arg0, 0x0100FA4C);
D_800EA170[arg0] = 1;
func_800C9060(playerId, 0x19009E59U);
func_800C8F80(playerId, 0x0100FA4C);
D_800EA170[playerId] = 1;
break;
}
}
}
void func_800CB064(u8 arg0) {
void func_800CB064(u8 playerId) {
if (D_800EA108 == 0) {
if (D_800EA170[arg0] == 1) {
if (D_800EA170[playerId] == 1) {
if ((u8) D_800EA168 == 0) {
func_800C36C4(0, 1U, 0x7FU, 0x19);
}
func_800C90F4(arg0, gPlayers[arg0].characterId * 0x10 + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
func_800C9018(arg0, SOUND_ARG_LOAD(0x01, 0x00, 0xFA, 0x4C));
D_800EA170[arg0] = 0;
func_800C90F4(playerId, gPlayers[playerId].characterId * 0x10 + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
func_800C9018(playerId, SOUND_ARG_LOAD(0x01, 0x00, 0xFA, 0x4C));
D_800EA170[playerId] = 0;
}
}
}
+34 -33
View File
@@ -3,6 +3,7 @@
#include <libultraship.h>
#include <common_structs.h>
#include "defines.h"
#include "camera.h"
#define ADSR_STATE_DISABLED 0
@@ -361,51 +362,51 @@ extern struct Sound sSoundRequests[0x100];
// Data entries
extern u8 D_800E9DA0;
extern s32 D_800E9DB4[];
extern f32 D_800E9DC4[4]; // = { 1.0f, 1.0f, 1.0f, 1.0f };
extern f32 D_800E9DD4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9DE4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9DF4[8]; // = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
extern s32 D_800E9E14[4]; // = { 0, 0, 0, 0 };
extern s32 D_800E9E24[4]; // = { 0, 0, 0, 0 };
extern s32 D_800E9E34[8];
extern f32 D_800E9E54[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */
extern f32 D_800E9E64[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern s32 D_800E9E74[4]; // = { 0, 0, 0, 0 }; /* const */
extern s32 D_800E9E84[4];
extern u32 D_800E9E94[4];
extern s32 D_800E9EA4[4]; // = { 0, 0, 0, 0 };
extern f32 D_800E9EB4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EC4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9ED4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EE4[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EF4[4];
extern f32 D_800E9F04[4]; // = { 1.0f, 1.0f, 1.0f, 1.0f };
extern f32 D_800E9F14[4]; // = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */
extern u8 D_800E9F24[8]; // = { 0, 0, 0, 0, 0, 0, 0, 0 };
extern u8 D_800E9F2C[8]; // = { 0, 0, 0, 0, 0, 0, 0, 0 };
extern f32 D_800E9F34[8]; // = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */
extern f32 D_800E9F54[8]; // = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */
extern u8 D_800E9F74[4];
extern u8 D_800E9F78[4];
extern struct Unk_800E9F7C D_800E9F7C[4];
extern f32 D_800E9DC4[NUM_PLAYERS]; // = { 1.0f, 1.0f, 1.0f, 1.0f };
extern f32 D_800E9DD4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9DE4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9DF4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
extern s32 D_800E9E14[NUM_PLAYERS]; // = { 0, 0, 0, 0 };
extern s32 D_800E9E24[NUM_PLAYERS]; // = { 0, 0, 0, 0 };
extern s32 D_800E9E34[NUM_PLAYERS];
extern f32 D_800E9E54[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */
extern f32 D_800E9E64[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern s32 D_800E9E74[NUM_PLAYERS]; // = { 0, 0, 0, 0 }; /* const */
extern s32 D_800E9E84[NUM_PLAYERS];
extern u32 D_800E9E94[NUM_PLAYERS];
extern s32 D_800E9EA4[NUM_PLAYERS]; // = { 0, 0, 0, 0 };
extern f32 D_800E9EB4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EC4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9ED4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EE4[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800E9EF4[NUM_PLAYERS];
extern f32 D_800E9F04[NUM_PLAYERS]; // = { 1.0f, 1.0f, 1.0f, 1.0f };
extern f32 D_800E9F14[NUM_PLAYERS]; // = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */
extern u8 D_800E9F24[NUM_PLAYERS]; // = { 0, 0, 0, 0, 0, 0, 0, 0 };
extern u8 D_800E9F2C[NUM_PLAYERS]; // = { 0, 0, 0, 0, 0, 0, 0, 0 };
extern f32 D_800E9F34[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */
extern f32 D_800E9F54[NUM_PLAYERS]; // = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */
extern u8 D_800E9F74[NUM_PLAYERS];
extern u8 D_800E9F78[NUM_PLAYERS];
extern struct Unk_800E9F7C D_800E9F7C[NUM_PLAYERS];
extern u8 D_800E9F90[];
extern struct Unk_800EA06C D_800EA06C[8];
extern struct Unk_800EA06C D_800EA06C[NUM_PLAYERS];
extern u8 D_800EA0EC[];
extern u8 D_800EA0F0; // = 0;
extern u8 D_800EA0F4;
extern u8 D_800EA104;
extern u8 D_800EA108; // = 0;
extern u8 D_800EA10C[];
extern f32 D_800EA110[4]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800EA120[4];
extern f32 D_800EA130[8];
extern u8 D_800EA10C[NUM_PLAYERS];
extern f32 D_800EA110[NUM_PLAYERS]; // = { 0.0f, 0.0f, 0.0f, 0.0f };
extern f32 D_800EA120[NUM_PLAYERS];
extern f32 D_800EA130[NUM_PLAYERS];
extern f32 D_800EA150; // = 1.4f;
extern u8 D_800EA154[];
extern u16 gCurrentMusicSeq;
extern u16 D_800EA160;
extern u8 D_800EA164;
extern s8 D_800EA168;
extern u8 D_800EA170[];
extern u8 D_800EA170[NUM_PLAYERS];
extern u16 D_800EA174; // = 0;
extern f32 D_800EA178;
extern f32 D_800EA17C;
+11
View File
@@ -485,6 +485,17 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
aligned = ALIGN(((loopInfo_2 * 9) + 16), 4);
addr = (0x540 - aligned); // DMEM_ADDR_COMPRESSED_ADPCM_DATA
// Bounds check: clamp read size to not exceed sample buffer
if (audioBookSample->sampleSize > 0) {
s32 readOffset = (var_a0_2 - var_t2) - sampleAddr;
if (readOffset < 0) readOffset = 0;
s32 maxReadSize = (s32)audioBookSample->sampleSize - readOffset;
if (maxReadSize < 0) maxReadSize = 0;
if (aligned > maxReadSize) {
aligned = maxReadSize;
}
}
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(var_a0_2 - var_t2), addr, aligned);
} else {
s1 = 0; // ?
+1 -1
View File
@@ -1136,7 +1136,7 @@ void func_8001F394(Player* player) {
s32 playerIndex = player - gPlayerOne;
UNUSED s32 pad2;
Camera* camera = CM_GetPlayerCamera(player - gPlayerOne);
Camera* camera = CM_GetPlayerCamera(playerIndex);
if (NULL == camera) {
printf("[camera.c][func_8001F394] Could not find a camera using GetPlayerCamera()\n");
+1 -1
View File
@@ -252,7 +252,7 @@ Vec3f D_80183E70;
s32 gNextFreeLeafParticle;
Vec3su D_80183E80;
//! Appears to be a list of object list indices for the Item Window part of the HUD
s32 gItemWindowObjectByPlayerId[4];
s32 gItemWindowObjectByPlayerId[8];
Vec3su D_80183E98;
/**
* Snowmen bodies in FrappeSnowland
+4 -8
View File
@@ -106,7 +106,7 @@ void World::TickCameras() {
}
}
for (GameCamera* camera : Cameras) {
for (auto& camera : Cameras) {
if (camera->IsActive()) {
camera->Tick();
}
@@ -215,9 +215,9 @@ void World::TickObjects60fps() {
}
}
ParticleEmitter* World::AddEmitter(ParticleEmitter* emitter) {
Emitters.push_back(emitter);
return Emitters.back();
ParticleEmitter* World::AddEmitter(std::unique_ptr<ParticleEmitter> emitter) {
Emitters.push_back(std::move(emitter));
return Emitters.back().get();
}
void World::DrawObjects(s32 cameraId) {
@@ -259,10 +259,6 @@ void World::CleanWorld(void) {
World::Reset(); // Reset OObjects
for (auto& emitter : Emitters) {
delete emitter;
}
for (size_t i = 0; i < ARRAY_COUNT(mPlayerBombKart); i++) {
mPlayerBombKart[i].state = PlayerBombKart::PlayerBombKartState::DISABLED;
mPlayerBombKart[i]._primAlpha = 0;
+4 -4
View File
@@ -86,10 +86,10 @@ public:
void TickParticles();
void DrawParticles(s32 cameraId);
ParticleEmitter* AddEmitter(ParticleEmitter* emitter);
ParticleEmitter* AddEmitter(std::unique_ptr<ParticleEmitter> emitter);
void Reset(void); // Sets OObjects or AActors static member variables back to default values
void AddCup(Cup*);
void AddCup(Cup* cup);
void SetCurrentCup(Cup* cup);
Cup* GetCurrentCup() {
return CurrentCup;
@@ -115,12 +115,12 @@ public:
std::vector<Cup*> Cups;
size_t CupIndex = 1;
std::vector<GameCamera*> Cameras;
std::vector<std::unique_ptr<GameCamera>> Cameras;
std::vector<std::unique_ptr<StaticMeshActor>> StaticMeshActors;
std::vector<std::unique_ptr<AActor>> Actors;
std::vector<std::unique_ptr<OObject>> Objects;
std::vector<ParticleEmitter*> Emitters;
std::vector<std::unique_ptr<ParticleEmitter>> Emitters;
std::unordered_map<s32, OLakitu*> Lakitus;
+11 -10
View File
@@ -40,7 +40,7 @@ namespace TrackEditor {
printf("Editor: Loading Editor...\n");
eObjectPicker.Load();
for (auto& object : eGameObjects) {
GenerateCollisionMesh(object, (Gfx*)object->Model, 1.0f);
GenerateCollisionMesh(object.get(), (Gfx*)object->Model, 1.0f);
object->Load();
}
@@ -150,7 +150,11 @@ namespace TrackEditor {
eObjectPicker.eGizmo.SelectedHandle = Gizmo::GizmoHandle::None;
eObjectPicker.eGizmo.ManipulationStart = true;
if (!isDragging) {
eObjectPicker.SelectObject(eGameObjects);
std::vector<GameObject*> objects;
for (auto& object : eGameObjects) {
objects.push_back(object.get());
}
eObjectPicker.SelectObject(objects);
}
}
@@ -178,25 +182,22 @@ namespace TrackEditor {
// pos->x, pos->y, pos->z, name, model);
if (nullptr != model && model[0] != '\0') {
eGameObjects.push_back(new GameObject(pos, rot, scale, model, {}, collision, boundingBoxSize));
GenerateCollisionMesh(eGameObjects.back(), (Gfx*)LOAD_ASSET_RAW(model), collScale);
eGameObjects.push_back(std::make_unique<GameObject>(pos, rot, scale, model, std::vector<Triangle>(), collision, boundingBoxSize));
GenerateCollisionMesh(eGameObjects.back().get(), (Gfx*)LOAD_ASSET_RAW(model), collScale);
} else { // to bounding box or sphere collision
eGameObjects.push_back(new GameObject(pos, rot, scale, model, {}, GameObject::CollisionType::BOUNDING_BOX,
eGameObjects.push_back(std::make_unique<GameObject>(pos, rot, scale, model, std::vector<Triangle>(), GameObject::CollisionType::BOUNDING_BOX,
10.0f));
}
return eGameObjects.back();
return eGameObjects.back().get();
}
void Editor::AddLight(const char* name, FVector* pos, s8* rot) {
eGameObjects.push_back(new LightObject(name, pos, rot));
eGameObjects.push_back(std::make_unique<LightObject>(name, pos, rot));
}
void Editor::ClearObjects() {
ResetGizmo();
for (auto& obj : eGameObjects) {
delete obj;
}
eGameObjects.clear();
}
+1 -1
View File
@@ -23,7 +23,7 @@ public:
~Editor();
ObjectPicker eObjectPicker;
std::vector<GameObject*> eGameObjects;
std::vector<std::unique_ptr<GameObject>> eGameObjects;
void Load();
void Enable();
+1
View File
@@ -27,6 +27,7 @@ public:
GameObject(FVector pos, IRotator rot, FVector scale, const char* model, std::vector<Triangle> triangles, CollisionType collision, float boundingBoxSize);
GameObject();
virtual ~GameObject() = default;
virtual void Tick();
virtual void Draw();
virtual void Load() {};
+2 -2
View File
@@ -203,7 +203,7 @@ std::pair<GameObject*, float> ObjectPicker::CheckEditorObjectRay(Ray ray) {
if (IntersectRayTriangleAndTransform(ray, object->Pos, tri, t)) {
if (t < hitDistance) {
hitDistance = t;
hitObject = object;
hitObject = object.get();
}
}
}
@@ -222,7 +222,7 @@ std::pair<GameObject*, float> ObjectPicker::CheckEditorObjectRay(Ray ray) {
if (QueryCollisionRayActor(&ray.Origin.x, &ray.Direction.x, boxMin, boxMax, &t)) {
if (t < hitDistance) {
hitDistance = t;
hitObject = object;
hitObject = object.get();
printf("FOUND BOUNDING BOX OBJECT\n");
}
break;
+6
View File
@@ -79,6 +79,12 @@ std::vector<std::string> ListMods() {
const std::string mods_path = Ship::Context::GetPathRelativeToAppDirectory("mods");
// Create mods folder if it doesn't exist
if (!std::filesystem::exists(mods_path)) {
std::filesystem::create_directories(mods_path);
SPDLOG_INFO("Created mods folder at: {}", mods_path);
}
if (std::filesystem::exists(mods_path) && std::filesystem::is_directory(mods_path)) {
for (const auto& p : std::filesystem::directory_iterator(mods_path)) {
auto ext = p.path().extension().string();
+1 -1
View File
@@ -92,7 +92,7 @@ OTrophy::OTrophy(const SpawnParams& params) : OObject(params) {
object->pos[1] = spawnPos.y;
object->pos[2] = spawnPos.z;
_emitter = reinterpret_cast<StarEmitter*>(GetWorld()->AddEmitter(new StarEmitter()));
_emitter = reinterpret_cast<StarEmitter*>(GetWorld()->AddEmitter(std::make_unique<StarEmitter>()));
}
void OTrophy::SetSpawnParams(SpawnParams& params) {
+8
View File
@@ -287,6 +287,7 @@ void KoopaTroopaBeach::ScrollingTextures() {
}
void KoopaTroopaBeach::DrawWater(ScreenContext* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
Vec3f vector;
gDPPipeSync(gDisplayListHead++);
@@ -312,6 +313,13 @@ void KoopaTroopaBeach::DrawWater(ScreenContext* screen, uint16_t pathCounter, ui
vector[0] = 0.0f;
vector[1] = Props.WaterLevel;
vector[2] = 0.0f;
mtxf_translate(matrix, vector);
if (gIsMirrorMode != 0) {
matrix[0][0] = -1.0f;
// matrix[1][1] = -1.0f;
// matrix[2][2] = -1.0f;
}
render_set_position(matrix, 0);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
+40 -44
View File
@@ -60,11 +60,11 @@ static World sWorldInstance;
// Deferred cleaning when clearing all actors in the editor
bool bCleanWorld = false;
Cup* gMushroomCup;
Cup* gFlowerCup;
Cup* gStarCup;
Cup* gSpecialCup;
Cup* gBattleCup;
std::unique_ptr<Cup> gMushroomCup;
std::unique_ptr<Cup> gFlowerCup;
std::unique_ptr<Cup> gStarCup;
std::unique_ptr<Cup> gSpecialCup;
std::unique_ptr<Cup> gBattleCup;
HarbourMastersIntro gMenuIntro;
@@ -96,35 +96,35 @@ void CustomEngineInit() {
TrackBrowser::Instance->FindCustomTracks();
TrackBrowser::Instance->Refresh(gTrackRegistry);
gMushroomCup = new Cup("mk:mushroom_cup", "Mushroom Cup", {
gMushroomCup = std::make_unique<Cup>("mk:mushroom_cup", "Mushroom Cup", std::vector<std::string>{
"mk:luigi_raceway",
"mk:moo_moo_farm",
"mk:koopa_troopa_beach",
"mk:kalimari_desert"
});
gFlowerCup = new Cup("mk:flower_cup", "Flower Cup", {
gFlowerCup = std::make_unique<Cup>("mk:flower_cup", "Flower Cup", std::vector<std::string>{
"mk:toads_turnpike",
"mk:frappe_snowland",
"mk:choco_mountain",
"mk:mario_raceway"
});
gStarCup = new Cup("mk:star_cup", "Star Cup", {
gStarCup = std::make_unique<Cup>("mk:star_cup", "Star Cup", std::vector<std::string>{
"mk:wario_stadium",
"mk:sherbet_land",
"mk:royal_raceway",
"mk:bowsers_castle"
});
gSpecialCup = new Cup("mk:special_cup", "Special Cup", {
gSpecialCup = std::make_unique<Cup>("mk:special_cup", "Special Cup", std::vector<std::string>{
"mk:dk_jungle",
"mk:yoshi_valley",
"mk:banshee_boardwalk",
"mk:rainbow_road"
});
gBattleCup = new Cup("mk:battle_cup", "Battle Cup", {
gBattleCup = std::make_unique<Cup>("mk:battle_cup", "Battle Cup", std::vector<std::string>{
"mk:big_donut",
"mk:block_fort",
"mk:double_deck",
@@ -139,11 +139,11 @@ void CustomEngineInit() {
gBattleCup->ValidateTrackIds(gTrackRegistry);
/* Instantiate Cups */
GetWorld()->AddCup(gMushroomCup);
GetWorld()->AddCup(gFlowerCup);
GetWorld()->AddCup(gStarCup);
GetWorld()->AddCup(gSpecialCup);
GetWorld()->AddCup(gBattleCup);
GetWorld()->AddCup(gMushroomCup.get());
GetWorld()->AddCup(gFlowerCup.get());
GetWorld()->AddCup(gStarCup.get());
GetWorld()->AddCup(gSpecialCup.get());
GetWorld()->AddCup(gBattleCup.get());
SetMarioRaceway();
@@ -157,11 +157,11 @@ void CustomEngineInit() {
void CustomEngineDestroy() {
gTrackRegistry.Clear();
gActorRegistry.Clear();
delete gMushroomCup;
delete gFlowerCup;
delete gStarCup;
delete gSpecialCup;
delete gBattleCup;
gMushroomCup.reset();
gFlowerCup.reset();
gStarCup.reset();
gSpecialCup.reset();
gBattleCup.reset();
}
extern "C" {
@@ -181,7 +181,7 @@ void HM_DrawIntro() {
// Set default track; mario raceway
void SetMarioRaceway(void) {
SelectMarioRaceway();
GetWorld()->SetCurrentCup(gMushroomCup);
GetWorld()->SetCurrentCup(gMushroomCup.get());
GetWorld()->GetCurrentCup()->CursorPosition = 3;
GetWorld()->CupIndex = 0;
}
@@ -342,8 +342,8 @@ void CM_DrawActors(Camera* camera) {
}
}
for (auto* camera : GetWorld()->Cameras) {
if (auto* tourCam = dynamic_cast<TourCamera*>(camera)) {
for (auto& camera : GetWorld()->Cameras) {
if (auto* tourCam = dynamic_cast<TourCamera*>(camera.get())) {
if (tourCam->IsActive()) {
tourCam->Draw();
}
@@ -366,7 +366,7 @@ void CM_BeginPlay() {
if (tour) {
// GetWorld()->Cameras[2]->SetActive(true);
// gScreenOneCtx->camera = GetWorld()->Cameras[2]->Get();
if (reinterpret_cast<TourCamera*>(GetWorld()->Cameras[2])->IsTourComplete()) {
if (reinterpret_cast<TourCamera*>(GetWorld()->Cameras[2].get())->IsTourComplete()) {
tour = false;
gScreenOneCtx->pendingCamera = &cameras[0];
}
@@ -378,7 +378,7 @@ void CM_BeginPlay() {
}
Camera* CM_GetPlayerCamera(s32 playerIndex) {
for (GameCamera* cam : GetWorld()->Cameras) {
for (auto& cam : GetWorld()->Cameras) {
// Make sure this is a player camera and not a different type of camera
if (typeid(*cam) == typeid(GameCamera)) {
Camera* camera = cam->Get();
@@ -391,7 +391,7 @@ Camera* CM_GetPlayerCamera(s32 playerIndex) {
}
void CM_SetViewProjection(Camera* camera) {
for (GameCamera* gameCamera : GetWorld()->Cameras) {
for (auto& gameCamera : GetWorld()->Cameras) {
if (camera == gameCamera->Get()) {
gameCamera->SetViewProjection();
}
@@ -407,7 +407,7 @@ Camera* CM_AddCamera(Vec3f spawn, s16 rot, u32 mode) {
printf("Reached the max number of cameras, %d\n", NUM_CAMERAS);
return nullptr;
}
GetWorld()->Cameras.push_back(new GameCamera(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
GetWorld()->Cameras.push_back(std::make_unique<GameCamera>(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
return GetWorld()->Cameras.back()->Get();
}
@@ -416,7 +416,7 @@ Camera* CM_AddFreeCamera(Vec3f spawn, s16 rot, u32 mode) {
printf("Reached the max number of cameras, %d\n", NUM_CAMERAS);
return nullptr;
}
GetWorld()->Cameras.push_back(new FreeCamera(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
GetWorld()->Cameras.push_back(std::make_unique<FreeCamera>(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
return GetWorld()->Cameras.back()->Get();
}
@@ -446,8 +446,8 @@ Camera* CM_AddTourCamera(Vec3f spawn, s16 rot, u32 mode) {
return nullptr;
}
GetWorld()->Cameras.push_back(new TourCamera(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
TourCamera* tour = static_cast<TourCamera*>(GetWorld()->Cameras.back());
GetWorld()->Cameras.push_back(std::make_unique<TourCamera>(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
TourCamera* tour = static_cast<TourCamera*>(GetWorld()->Cameras.back().get());
tour->SetActive(true);
return tour->Get();
}
@@ -469,7 +469,7 @@ Camera* CM_AddLookBehindCamera(Vec3f spawn, s16 rot, u32 mode) {
printf("Reached the max number of cameras, %d\n", NUM_CAMERAS);
return nullptr;
}
GetWorld()->Cameras.push_back(new LookBehindCamera(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
GetWorld()->Cameras.push_back(std::make_unique<LookBehindCamera>(FVector(spawn[0], spawn[1], spawn[2]), rot, mode));
return GetWorld()->Cameras.back()->Get();
}
@@ -484,7 +484,7 @@ void CM_CameraSetActive(size_t idx, bool state) {
}
void CM_SetFreeCamera(bool state) {
for (auto* cam : GetWorld()->Cameras) {
for (auto& cam : GetWorld()->Cameras) {
if (cam->Get() == gScreenOneCtx->freeCamera) {
if (state) {
gScreenOneCtx->pendingCamera = gScreenOneCtx->freeCamera;
@@ -504,7 +504,7 @@ void CM_SetFreeCamera(bool state) {
}
void CM_ActivateTourCamera(Camera* camera) {
for (auto* cam : GetWorld()->Cameras) {
for (auto& cam : GetWorld()->Cameras) {
if (cam->Get() == camera) {
cam->SetActive(true);
}
@@ -714,11 +714,11 @@ void* GetTrack(void) {
}
struct Actor* CM_GetActor(size_t index) {
if (index < GetWorld()->Actors.size()) {
if (index >= 0 && index < GetWorld()->Actors.size()) {
AActor* actor = GetWorld()->Actors[index].get();
return reinterpret_cast<struct Actor*>(reinterpret_cast<char*>(actor) + sizeof(void*));
} else {
// throw std::runtime_error("GetActor() index out of bounds");
throw std::runtime_error("GetActor() index out of bounds");
return NULL;
}
}
@@ -755,10 +755,6 @@ void CM_CleanWorld(void) {
}
void CM_CleanCameras(void) {
for (auto& camera : GetWorld()->Cameras) {
delete camera;
}
GetWorld()->Cameras.clear();
}
@@ -861,23 +857,23 @@ void SelectPodiumCeremony() { GetWorld()->SetCurrentTrack(std::make_unique<P
// clang-format on
void* GetMushroomCup(void) {
return gMushroomCup;
return gMushroomCup.get();
}
void* GetFlowerCup(void) {
return gFlowerCup;
return gFlowerCup.get();
}
void* GetStarCup(void) {
return gStarCup;
return gStarCup.get();
}
void* GetSpecialCup(void) {
return gSpecialCup;
return gSpecialCup.get();
}
void* GetBattleCup(void) {
return gBattleCup;
return gBattleCup.get();
}
// End of frame cleanup of actors, objects, etc.
@@ -733,8 +733,8 @@ void FrameInterpolation_RecordMatrixTranslate(Mat4* matrix, Vec3f b) {
if (!check_if_recording()) {
return;
}
append(Op::MatrixTranslate).matrix_translate = { matrix, *((Vec3fInterp*) &b) };
// Note: Vec3f decays to pointer when passed as parameter. Cast directly, not &b.
append(Op::MatrixTranslate).matrix_translate = { matrix, *((Vec3fInterp*) b) };
}
void FrameInterpolation_RecordMatrixScale(Mat4* matrix, f32 scale) {
@@ -786,7 +786,9 @@ void FrameInterpolation_RecordMatrixPosRotXYZ(Mat4* out, Vec3f pos, Vec3s orient
if (!check_if_recording()) {
return;
}
append(Op::MatrixPosRotXYZ).matrix_pos_rot_xyz = { out, *((Vec3fInterp*) &pos), *((Vec3sInterp*) &orientation) };
// Note: Vec3f and Vec3s decay to pointers when passed as parameters.
// We cast the pointer directly (not &pos which would be pointer-to-pointer).
append(Op::MatrixPosRotXYZ).matrix_pos_rot_xyz = { out, *((Vec3fInterp*) pos), *((Vec3sInterp*) orientation) };
}
void FrameInterpolation_RecordMatrixPosRotScaleXY(Mat4* matrix, s32 x, s32 y, u16 angle, f32 scale) {
+1 -1
View File
@@ -80,7 +80,7 @@ namespace TrackEditor {
std::string label = fmt::format("{}##{}", name, id);
if (ImGui::Button(label.c_str())) {
gEditor.SelectObjectFromSceneExplorer(object);
gEditor.SelectObjectFromSceneExplorer(object.get());
}
id += 1;
}
+12 -6
View File
@@ -393,12 +393,18 @@ void update_actor_triple_shell(TripleShellParent* parent, s16 shellType) {
break;
case SHELL_COLLISION:
parent->state = ORBIT_PLAYER;
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[0]);
shell->flags |= 0x4000;
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[1]);
shell->flags |= 0x4000;
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[2]);
shell->flags |= 0x4000;
if (parent->shellIndices[0] != -1) {
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[0]);
shell->flags |= 0x4000;
}
if (parent->shellIndices[1] != -1) {
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[1]);
shell->flags |= 0x4000;
}
if (parent->shellIndices[2] != -1) {
shell = (struct ShellActor*) GET_ACTOR((s16) parent->shellIndices[2]);
shell->flags |= 0x4000;
}
break;
case ORBIT_PLAYER:
shellCount = 0;
+6 -1
View File
@@ -1344,7 +1344,12 @@ void render_kart(Player* player, s8 playerId, s8 screenId, s8 flipOffset) {
}
load_kart_palette(player, playerId, screenId, D_801651D0[screenId][playerId]);
gPlayerPalette = &gPlayerPalettesList[D_801651D0[screenId][playerId]][screenId][playerId];
load_kart_texture(player, playerId, screenId, screenId, D_801651D0[screenId][playerId]);
// When screenId >= 2 (in 3/4 player mode), adjust indices to fit gEncodedKartTexture[2][2][8] dimensions
if ((screenId == 0) || (screenId == 1)) {
load_kart_texture(player, playerId, screenId, screenId, D_801651D0[screenId][playerId]);
} else {
load_kart_texture(player, playerId - 4, screenId, screenId - 1, D_801651D0[screenId][playerId]);
}
if ((screenId == 0) || (screenId == 1)) {
sKartTexture = gEncodedKartTexture[D_801651D0[screenId][playerId]][screenId][playerId].unk_00;
} else {
+1 -1
Submodule torch updated: 0c6e9523b3...2d474ddb8d