- Program crashing CEmu [solved]
- 10 May 2020 08:47:08 pm
- Last edited by Captain Calc on 11 May 2020 09:19:24 am; edited 1 time in total
While I was working on the next release of Mental Math CE, some of the code that I added made CEmu crash completely. Resetting the calculator did nothing, but when I reset CEmu, it began working again.
The code that I added between the last successful run was the following code in problem_sets.h:
Code:
A screenshot of the CEmu console after the crash (the debugging output above the red error code is in input.c):
Could one of the developers tell me what is wrong?
The code that I added between the last successful run was the following code in problem_sets.h:
Code:
if (exercise.type == COMPLEMENTS) {
width = 220;
height = 80;
dialog((320 - width) / 2, (240 - height) / 2, width, height);
draw_input_box_centered("Complements of", (240 - height) / 2 + 20);
draw_input_box_centered("# of problems:", (240 - height) / 2 + 45);
gfx_BlitBuffer();
// Get upper bound (5 digits)
upper_bound_str = malloc(6);
memset(upper_bound_str, '\0', 6);
input_config.curr_char = upper_bound_str;
input_config.visible_buffer = upper_bound_str;
do {
do {
key = textio_NumericalInput(upper_bound_str, 5, 46, 188, 107);
gfx_BlitRectangle(1, 188, 107, 46, 11);
} while (key != sk_Enter && key != sk_Yequ && key != sk_Graph);
if (key == sk_Yequ) {
free(upper_bound_str);
goto EXIT_MENU;
};
} while (atoi((const char*)upper_bound_str) == 0);
exercise.upper_bound_1 = atoi((const char*)upper_bound_str);
free(upper_bound_str);
// Get number of problems (2 digits)
num_problems_str = malloc(3);
memset(num_problems_str, '\0', 3);
input_config.curr_char = num_problems_str;
input_config.visible_buffer = num_problems_str;
do {
do {
key = textio_NumericalInput(num_problems_str, 2, 46, 185, 132);
gfx_BlitRectangle(1, 185, 132, 46, 11);
} while (key != sk_Enter && key != sk_Yequ && key != sk_Graph);
if (key == sk_Yequ) {
free(num_problems_str);
goto EXIT_MENU;
};
} while (atoi((const char*)num_problems_str) == 0);
exercise.num_problems = atoi((const char*)num_problems_str);
free(num_problems_str);
// For this exercise, the range is from the entered number (upper_bound_1) to zero.
exercise.lower_bound_1 = 0;
};
A screenshot of the CEmu console after the crash (the debugging output above the red error code is in input.c):

Could one of the developers tell me what is wrong?