Difference between revisions of "User:Mddass"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Crash 2 Return/Error Codes)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
 
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
 +
 +
[[User:Mddass/List of GOOL Executables]]
  
 
== Crash 2 Return/Error Codes ==
 
== Crash 2 Return/Error Codes ==
Engine assumes codes range from <code>0xFFFFFF01</code> to <code>0xFFFFFFFF</code>.
+
Engine assumes codes range from <code>0xFFFFFF01</code> to <code>0xFFFFFFFF</code>. A special return/error code, <code>0</code>, is used in certain GOOL interpretation functions (event, state change, animation change) to indicate that the function failed and/or that interpretation should continue.
 
{| border="1"
 
{| border="1"
 
!Code
 
!Code
Line 28: Line 30:
 
|
 
|
 
|-
 
|-
|0xFFFFFFE8 (-0x19)
+
|0xFFFFFFE7 (-0x19)
 
|GOOL stack frame update unsuccessful.
 
|GOOL stack frame update unsuccessful.
 
|
 
|
Line 34: Line 36:
 
|0xFFFFFFE8 (-0x18)
 
|0xFFFFFFE8 (-0x18)
 
|Object linked list remove unsuccessful.
 
|Object linked list remove unsuccessful.
 +
|
 +
|-
 +
|0xFFFFFFEA (-0x16)
 +
|Object could not be spawned from entity, pools are full.
 
|
 
|
 
|-
 
|-
Line 52: Line 58:
 
|-
 
|-
 
|0xFFFFFFF1 (-0xF)
 
|0xFFFFFFF1 (-0xF)
|Memory allocation failed.
+
|Out of memory.
 
|
 
|
 
|-
 
|-
 
|0xFFFFFFF2 (-0xE)
 
|0xFFFFFFF2 (-0xE)
|Error initiating object.
+
|Object is malformed.
 
Texture load success.
 
Texture load success.
 
|Returned on state change if object status b-flag 0x10000000 is set or if state is 255 (invalid), etc.
 
|Returned on state change if object status b-flag 0x10000000 is set or if state is 255 (invalid), etc.
Line 69: Line 75:
 
|-
 
|-
 
|}
 
|}
 +
 +
== Crash 2 GOOL Interpretation Locations ==
 +
<syntaxhighlight lang="c">
 +
uint GoolChangeObjState(c2_object_s *obj,int newstate,int argc,int *argv)
 +
{
 +
    ...
 +
    // if hpc (hpc is reset to NULL before this, hpc used here is from before)
 +
    GOOLInterpret(obj,0x13,NULL); // hpc
 +
    ...
 +
    // if tpc and is last updated object
 +
    GOOLInterpret(obj,0x3,NULL); // obj->tpc = state->tpc
 +
    ...
 +
}
 +
 +
uint FUN_8001c718(c2_object_s *obj,int unkflag) // some object update routine every frame
 +
{
 +
    ...
 +
    // if tpc
 +
    GOOLInterpret(obj,0x3,NULL); // tpc
 +
    ...
 +
    // if wait is 0
 +
    GOOLInterpret(obj,0x4,NULL); // ??? pc
 +
    ...
 +
}
 +
 +
uint ObjSendEvent(c2_object_s *sender,c2_object_s *receiver,int event,int argc,uint *argv)
 +
{
 +
    ...
 +
    // if receiver->epc
 +
    GOOLInterpret(receiver,0x8,NULL); // tpc
 +
    ...
 +
    // if previous interpretation was unsuccesful and interrupt is mapped to subroutine
 +
    GOOLInterpret(receiver,0x3,NULL); // interrupt-pc
 +
    ...
 +
    GoolChangeObjState(receiver,eState,argc,argv);
 +
    ...
 +
}
 +
 +
void GoolInterrupt(c2_object_s *obj,uint newpc,int argc,uint *argv)
 +
{
 +
    ...
 +
    GOOLInterpret(obj,0x3,NULL); // newpc
 +
    ...
 +
}
 +
</syntaxhighlight>

Latest revision as of 00:40, 29 July 2020

testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest

User:Mddass/List of GOOL Executables

Crash 2 Return/Error Codes

Engine assumes codes range from 0xFFFFFF01 to 0xFFFFFFFF. A special return/error code, 0, is used in certain GOOL interpretation functions (event, state change, animation change) to indicate that the function failed and/or that interpretation should continue.

Code Meaning Additional Notes
0xFFFFFF01 (-0xFF) No error.
0xFFFFFF02 (-0xFE) Error finding specified file. "File" includes entries and disc files.
0xFFFFFFE5 (-0x1B) The specified object state is invalid. For example, when an object's subtype corresponds to state 255 (invalid).
0xFFFFFFE6 (-0x1A) Event failed? GOOL interpreter failed?
0xFFFFFFE7 (-0x19) GOOL stack frame update unsuccessful.
0xFFFFFFE8 (-0x18) Object linked list remove unsuccessful.
0xFFFFFFEA (-0x16) Object could not be spawned from entity, pools are full.
0xFFFFFFEE (-0x12) Chunk load failed. Wrong magic, invalid page pointer, etc.
0xFFFFFFF0 (-0x10) Unknown. Returned by FUN_80012ed0 and FUN_80013084. Chunk load success?
0xFFFFFFF1 (-0xF) Out of memory.
0xFFFFFFF2 (-0xE) Object is malformed.

Texture load success.

Returned on state change if object status b-flag 0x10000000 is set or if state is 255 (invalid), etc.
0xFFFFFFF6 (-0xA) Tried to find null entry. GetEntry was trying to find "NONE!".

Crash 2 GOOL Interpretation Locations

uint GoolChangeObjState(c2_object_s *obj,int newstate,int argc,int *argv)
{
    ...
    // if hpc (hpc is reset to NULL before this, hpc used here is from before)
    GOOLInterpret(obj,0x13,NULL); // hpc
    ...
    // if tpc and is last updated object
    GOOLInterpret(obj,0x3,NULL); // obj->tpc = state->tpc
    ...
}

uint FUN_8001c718(c2_object_s *obj,int unkflag) // some object update routine every frame
{
    ...
    // if tpc
    GOOLInterpret(obj,0x3,NULL); // tpc
    ...
    // if wait is 0
    GOOLInterpret(obj,0x4,NULL); // ??? pc
    ...
}

uint ObjSendEvent(c2_object_s *sender,c2_object_s *receiver,int event,int argc,uint *argv)
{
    ...
    // if receiver->epc
    GOOLInterpret(receiver,0x8,NULL); // tpc
    ...
    // if previous interpretation was unsuccesful and interrupt is mapped to subroutine
    GOOLInterpret(receiver,0x3,NULL); // interrupt-pc
    ...
    GoolChangeObjState(receiver,eState,argc,argv);
    ...
}

void GoolInterrupt(c2_object_s *obj,uint newpc,int argc,uint *argv)
{
    ...
    GOOLInterpret(obj,0x3,NULL); // newpc
    ...
}