diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index c8b20371..4f7a1f0b 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -1,6 +1,4 @@ -#include - #include #include @@ -77,7 +75,7 @@ fs::path file_to_load; fs::path store_file_reply; short jl; -bool cur_scen_is_mac = true; +extern bool cur_scen_is_mac; void print_write_position (); void save_outdoor_maps(); diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index 125e8751..39ea0f36 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -29,8 +29,6 @@ #include "boe.menus.h" #include "cursors.h" -#include - extern cursor_type arrow_curs[3][3]; extern cursor_type current_cursor; @@ -144,8 +142,6 @@ bool sleep_field; // // Main body of program Exile // -void check_for_intel(); -bool mac_is_intel; int main(int argc, char* argv[]) { #if 0 @@ -217,16 +213,6 @@ int main(int argc, char* argv[]) { } } -void check_for_intel(){ - int response = CFByteOrderGetCurrent(); - if(response == CFByteOrderUnknown){ - printf("Gestalt error\n"); - exit(1); - } - if(response == CFByteOrderLittleEndian) mac_is_intel = true; - else mac_is_intel = false; -} - // // Initialize everything for the program, make sure we can run // diff --git a/osx/pcedit/pc.main.cpp b/osx/pcedit/pc.main.cpp index f2f0d429..6c2d304d 100644 --- a/osx/pcedit/pc.main.cpp +++ b/osx/pcedit/pc.main.cpp @@ -16,9 +16,6 @@ #include "pc.menus.h" #include "winutil.h" #include "cursors.h" -#ifdef __APPLE__ -#include -#endif extern std::string get_str(std::string, short); @@ -92,7 +89,7 @@ bool verify_restore_quit(bool mode); void set_up_apple_events(); void handle_item_menu(int item_hit); //item_record_type convert_item (short_item_record_type s_item); -bool cur_scen_is_mac, mac_is_intel; +extern bool cur_scen_is_mac; extern fs::path progDir; // File io short specials_res_id; @@ -132,7 +129,6 @@ int main(int argc, char* argv[]) { // //MW specified argument and return type. -void check_for_intel(); void Initialize(void) { @@ -241,16 +237,6 @@ void handle_file_menu(int item_hit) } } -void check_for_intel(){ - int response = CFByteOrderGetCurrent(); - if(response == CFByteOrderUnknown){ - printf("Gestalt error\n"); - exit(1); - } - if(response == CFByteOrderLittleEndian) mac_is_intel = true; - else mac_is_intel = false; -} - static void display_strings(short nstr, pic_num_t pic) { cStrDlog display_strings(get_str("pcedit", nstr), "", "Editing party", pic, PIC_DLOG); display_strings.setSound(57); diff --git a/osx/scenedit/scen.fileio.cpp b/osx/scenedit/scen.fileio.cpp index 05f35961..312ba84f 100644 --- a/osx/scenedit/scen.fileio.cpp +++ b/osx/scenedit/scen.fileio.cpp @@ -38,7 +38,7 @@ short start_volume,data_volume,jl = 0; fs::path temp_file_to_load; std::string last_load_file = "Blades of Exile Scenario"; extern fs::path progDir; -bool cur_scen_is_mac = true; +extern bool cur_scen_is_mac; void print_write_position (); void load_spec_graphics(); diff --git a/osx/scenedit/scen.main.cpp b/osx/scenedit/scen.main.cpp index 7b8ffdaf..48141a04 100644 --- a/osx/scenedit/scen.main.cpp +++ b/osx/scenedit/scen.main.cpp @@ -21,8 +21,6 @@ #include "dlogutil.h" #include "scen.menus.h" -#include - cUniverse univ; // not needed; just to silence the compiler /* Globals */ @@ -75,8 +73,6 @@ void ding(); cScenario scenario; //piles_of_stuff_dumping_type *data_store; RECT right_sbar_rect; -void check_for_intel(); -bool mac_is_intel; // // Main body of program Exileedit @@ -185,16 +181,6 @@ void Initialize(void) { right_sbar->hide(); } -void check_for_intel(){ - int response = CFByteOrderGetCurrent(); - if(response == CFByteOrderUnknown){ - printf("Gestalt error\n"); - exit(1); - } - if(response == CFByteOrderLittleEndian) mac_is_intel = true; - else mac_is_intel = false; -} - void Handle_One_Event() { short chr,chr2; long menu_choice; diff --git a/osx/tools/fileio.cpp b/osx/tools/fileio.cpp index 3a8dbeb0..bc63a132 100644 --- a/osx/tools/fileio.cpp +++ b/osx/tools/fileio.cpp @@ -22,7 +22,7 @@ #include "restypes.hpp" #include "tarball.hpp" -extern bool cur_scen_is_mac, mac_is_intel; +bool cur_scen_is_mac = true, mac_is_intel; extern cScenario scenario; extern sf::Texture items_gworld,tiny_obj_gworld,fields_gworld,roads_gworld,boom_gworld,missiles_gworld; extern sf::Texture dlogpics_gworld,monst_gworld[],terrain_gworld[],anim_gworld,talkfaces_gworld,pc_gworld; @@ -70,6 +70,12 @@ void init_directories(const char* exec_path) { tempDir /= "Temporary Files"; } +void check_for_intel() { + union {uint16_t x; uint8_t c;} endian; + endian.x = 1; + mac_is_intel = endian.c; +} + bool load_scenario(fs::path file_to_load, bool skip_strings){ short i,n; bool file_ok = false; diff --git a/osx/tools/fileio.h b/osx/tools/fileio.h index 1fa9aa92..53b9f309 100644 --- a/osx/tools/fileio.h +++ b/osx/tools/fileio.h @@ -30,6 +30,7 @@ bool load_party(fs::path file_to_load); bool save_party(fs::path dest_file); void init_directories(const char* exec_path); +void check_for_intel(); std::string read_maybe_quoted_string(std::istream& from); std::string maybe_quote_string(std::string which);