Comments (4)
Won’t be at my computer today, will check this out when I can, thanks!
from sm64coopdx.
Oh and since I wasn't really clear about this part of the explanation, in case this helps you understand it, the cause of the parameter to coss()
ending up being floating point to begin with is because doneShrinkingFrame
is an f32
and in C if you multiply and divide floating point numbers by other numbers, the expression evaluates into another floating point number, so in general there are a few different angles to the problem and there are multiple possible solutions.
from sm64coopdx.
This is a lot easier to get in whomps. I’ve encountered this error before, unsure on how to reproduce. It’s unrelated to the flame, but has to do with the piranha plant
from sm64coopdx.
Did you guys already try the solution invented in 2021 by VDavid003, the creator of the first port of singleplayer sm64ex to Android ARM?
--- a/src/game/behaviors/piranha_bubbles.inc.c
+++ b/src/game/behaviors/piranha_bubbles.inc.c
@@ -32,6 +32,9 @@ void bhv_piranha_plant_bubble_loop(void) {
f32 scale = 0;
s32 i;
s32 frame = parent->header.gfx.animInfo.animFrame;
+ if (frame < 0) {
+ frame = 0;
+ }
// TODO: rename lastFrame if it is inaccurate
if (parent->header.gfx.animInfo.curAnim == NULL) { return; }
s32 lastFrame = parent->header.gfx.animInfo.curAnim->loopEnd - 2;
It prevents the crash that also happens for me after compiling and running an unreleased fork of this repo (port of sm64coopdx 1.0.1 to Arch Linux ARM etc. - "sm64ex-coop" branding) with the clang
/clang++
compiler on my Arch Linux ARM true aarch64 emulator when interacting with piranha plants.
sm64ex-coop-371-arch-linux-arm-piranha-plant-crash-fixes-comparison.webm
When I conduct my own analysis of this crash today, I can see that the root cause of the problem is the same that you encountered before and read about in a different thread @EmeraldLoc , the undefined behavior of passing a negative floating point number to the coss()
macro which casts it to unsigned integer.
sm64coopdx/src/engine/math_util.h
Lines 27 to 28 in e4bdb1f
Knowing that, this alternative solution also becomes possible.
--- a/src/game/behaviors/piranha_bubbles.inc.c
+++ b/src/game/behaviors/piranha_bubbles.inc.c
@@ -71,7 +71,7 @@ void bhv_piranha_plant_bubble_loop(void) {
// Note that the bubble always starts this loop at its largest.
if (frame < doneShrinkingFrame) {
// Shrink from 5.0f to 1.0f.
- scale = coss(frame / doneShrinkingFrame * 0x4000) * 4.0f + 1.0;
+ scale = coss((s32)(frame / doneShrinkingFrame * 0x4000)) * 4.0f + 1.0;
} else if (frame > beginGrowingFrame) {
// Grow from 1.0f to 5.0f.
scale = sins((
That new solution also works for me to avoid the crash when interacting with the piranha plant, but I'm not completely sure whether it's the best solution or not. I still don't know how widespread bugs following this same pattern of problematic use of the sins()
and coss()
macros might be. If they are any more common beyond these two cases (this issue and the other issue that was deleted), the macros themselves might need to be replaced with something more robust.
from sm64coopdx.
Related Issues (20)
- Is it possible to have just the server without the client? HOT 1
- An actual way of disabling "Player Entered" and "Player Left" Popups (within code)
- Chatbox API HOT 3
- Why it does need Discord authorization? HOT 3
- [Suggestion] Automatically reconnect to CoopNet
- A way to access player's coopnet id's (via lua) HOT 3
- bring back sex in minecraft mod HOT 5
- the game 64/32bit supporter HOT 1
- A way to straight up remove water from a level, via lua HOT 3
- libSDL2-2.0.so.0: cannot open shared object file: No such file or directory HOT 7
- Chat API
- Game does not start HOT 2
- wheres mario HOT 1
- Auto-Refresh
- No "Reset Controls" button. HOT 1
- Plugging in a controller causes the game to freeze HOT 1
- Unable to run the program (Linux) HOT 31
- Can't bind joystick movements
- (not a copy of #19) any other ways to run sm64coopdx on android besides winlator? HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sm64coopdx.