From 8af1d14863bb6ffad2c50b5275a848240c68c62e Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 7 Jul 2015 19:33:33 -0700 Subject: Add support for reading cartridge memory map from ROM database, though without EEPROM support for now --- util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 780f538..85b0c8f 100644 --- a/util.h +++ b/util.h @@ -15,6 +15,8 @@ long file_size(FILE * f); char * strip_ws(char * text); //Inserts a null after the first word, returns a pointer to the second word char * split_keyval(char * text); +//Gets the smallest power of two that is >= a certain value, won't work for values > 0x80000000 +uint32_t nearest_pow2(uint32_t val); //Should be called by main with the value of argv[0] for use by get_exe_dir void set_exe_str(char * str); //Returns the directory the executable is in -- cgit v1.2.3 From 80ff833dd8ad011b579bff26ac654819e6735bce Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 25 Jul 2015 18:22:07 -0700 Subject: Use a new fatal_error function instead of calling fprintf and exit for fatal errors. This new function more gracefully handles the case in which BlastEm was not started from a terminal or disconnected from ther terminal (Windows). --- util.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 85b0c8f..537c97e 100644 --- a/util.h +++ b/util.h @@ -25,5 +25,9 @@ char * get_exe_dir(); char * get_home_dir(); //Returns the contents of a symlink in a newly allocated string char * readlink_alloc(char * path); +//Prints an error message to stderr and to a message box if not in headless mode and then exits +void fatal_error(char *format, ...); +//Prints an information message to stdout and to a message box if not in headless mode and not attached to a console +void info_message(char *format, ...); #endif //UTIL_H_ -- cgit v1.2.3 From bee8b42029900ca034675c54d98813a61ca4407a Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 26 Jul 2015 01:11:04 -0700 Subject: Spawn a terminal for the debugger when needed if we are not already attached to one --- util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 537c97e..ffa3385 100644 --- a/util.h +++ b/util.h @@ -29,5 +29,7 @@ char * readlink_alloc(char * path); void fatal_error(char *format, ...); //Prints an information message to stdout and to a message box if not in headless mode and not attached to a console void info_message(char *format, ...); +//Prints an information message to stderr and to a message box if not in headless mode and not attached to a console +void warning(char *format, ...); #endif //UTIL_H_ -- cgit v1.2.3