oops I was running the wrong nds file!!
But I managed to recreate the crash succesfully now:
here is structs.h
Code: Select all
#ifndef structs
#define structs
#define one_off 1
#define torso_img 0
#define right_arm_img 1
#define right_forearm_img 2
#define left_arm_img 3
#define left_forearm_img 4
static inline void gxTranslate3f32( int32 x, int32 y, int32 z )
{
MATRIX_TRANSLATE = x;
MATRIX_TRANSLATE = y;
MATRIX_TRANSLATE = z;
}
struct image
{
int width;
int height;
int handlex;
int handley;
int img_num;
};
//torso
struct body_part
{
char* name;
int img_num;
int x_pos;
int y_pos;
int angle;
m4x4 matrix;
};
struct limb_position
{
char *bodypart;
int angle;
int x_pos;
int y_pos;
int xscale;
int yscale;
};
struct pose
{
limb_position limb_positions[30];
int num;
int pose_delay;
};
struct animation
{
char *name;
int anim_type;
int pose_delay;
int pose_timer;
pose poses[30];
};
//#define new_string(my_string) (char *)malloc(sizeof(char) * (strlen(my_string)+1));
char* new_string(const char *my_string);
struct character
{
body_part body_part_array[10];
int x_pos;
int y_pos;
};
void draw_character(character c);
#endif
here is main.cpp
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "structs.h"
#include "heroanims.h"
//---------------------------------------------------------------------------------
int main(void) {
animation a =new_anim();
//---------------------------------------------------------------------------------
consoleDemoInit();
iprintf("this is a ds");
while(1) {
swiWaitForVBlank();
}
}
heroanims.h
Code: Select all
ifndef anims
#define anims
animation new_anim();
#endif
if you move new_anim in main.cpp to outside of main() it works,
it crashes when new_anim is inside main()
also if I remove a piece of the animation struct it works