Don't use CoreFoundation to check machine's endianness
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
@@ -77,7 +75,7 @@ fs::path file_to_load;
|
|||||||
fs::path store_file_reply;
|
fs::path store_file_reply;
|
||||||
short jl;
|
short jl;
|
||||||
|
|
||||||
bool cur_scen_is_mac = true;
|
extern bool cur_scen_is_mac;
|
||||||
|
|
||||||
void print_write_position ();
|
void print_write_position ();
|
||||||
void save_outdoor_maps();
|
void save_outdoor_maps();
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
#include "boe.menus.h"
|
#include "boe.menus.h"
|
||||||
#include "cursors.h"
|
#include "cursors.h"
|
||||||
|
|
||||||
#include <CoreFoundation/CFByteOrder.h>
|
|
||||||
|
|
||||||
extern cursor_type arrow_curs[3][3];
|
extern cursor_type arrow_curs[3][3];
|
||||||
extern cursor_type current_cursor;
|
extern cursor_type current_cursor;
|
||||||
|
|
||||||
@@ -144,8 +142,6 @@ bool sleep_field;
|
|||||||
//
|
//
|
||||||
// Main body of program Exile
|
// Main body of program Exile
|
||||||
//
|
//
|
||||||
void check_for_intel();
|
|
||||||
bool mac_is_intel;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
#if 0
|
#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
|
// Initialize everything for the program, make sure we can run
|
||||||
//
|
//
|
||||||
|
@@ -16,9 +16,6 @@
|
|||||||
#include "pc.menus.h"
|
#include "pc.menus.h"
|
||||||
#include "winutil.h"
|
#include "winutil.h"
|
||||||
#include "cursors.h"
|
#include "cursors.h"
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <CoreFoundation/CFByteOrder.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern std::string get_str(std::string, short);
|
extern std::string get_str(std::string, short);
|
||||||
|
|
||||||
@@ -92,7 +89,7 @@ bool verify_restore_quit(bool mode);
|
|||||||
void set_up_apple_events();
|
void set_up_apple_events();
|
||||||
void handle_item_menu(int item_hit);
|
void handle_item_menu(int item_hit);
|
||||||
//item_record_type convert_item (short_item_record_type s_item);
|
//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;
|
extern fs::path progDir;
|
||||||
// File io
|
// File io
|
||||||
short specials_res_id;
|
short specials_res_id;
|
||||||
@@ -132,7 +129,6 @@ int main(int argc, char* argv[]) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
//MW specified argument and return type.
|
//MW specified argument and return type.
|
||||||
void check_for_intel();
|
|
||||||
void Initialize(void)
|
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) {
|
static void display_strings(short nstr, pic_num_t pic) {
|
||||||
cStrDlog display_strings(get_str("pcedit", nstr), "", "Editing party", pic, PIC_DLOG);
|
cStrDlog display_strings(get_str("pcedit", nstr), "", "Editing party", pic, PIC_DLOG);
|
||||||
display_strings.setSound(57);
|
display_strings.setSound(57);
|
||||||
|
@@ -38,7 +38,7 @@ short start_volume,data_volume,jl = 0;
|
|||||||
fs::path temp_file_to_load;
|
fs::path temp_file_to_load;
|
||||||
std::string last_load_file = "Blades of Exile Scenario";
|
std::string last_load_file = "Blades of Exile Scenario";
|
||||||
extern fs::path progDir;
|
extern fs::path progDir;
|
||||||
bool cur_scen_is_mac = true;
|
extern bool cur_scen_is_mac;
|
||||||
|
|
||||||
void print_write_position ();
|
void print_write_position ();
|
||||||
void load_spec_graphics();
|
void load_spec_graphics();
|
||||||
|
@@ -21,8 +21,6 @@
|
|||||||
#include "dlogutil.h"
|
#include "dlogutil.h"
|
||||||
#include "scen.menus.h"
|
#include "scen.menus.h"
|
||||||
|
|
||||||
#include <CoreFoundation/CFByteOrder.h>
|
|
||||||
|
|
||||||
cUniverse univ; // not needed; just to silence the compiler
|
cUniverse univ; // not needed; just to silence the compiler
|
||||||
|
|
||||||
/* Globals */
|
/* Globals */
|
||||||
@@ -75,8 +73,6 @@ void ding();
|
|||||||
cScenario scenario;
|
cScenario scenario;
|
||||||
//piles_of_stuff_dumping_type *data_store;
|
//piles_of_stuff_dumping_type *data_store;
|
||||||
RECT right_sbar_rect;
|
RECT right_sbar_rect;
|
||||||
void check_for_intel();
|
|
||||||
bool mac_is_intel;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Main body of program Exileedit
|
// Main body of program Exileedit
|
||||||
@@ -185,16 +181,6 @@ void Initialize(void) {
|
|||||||
right_sbar->hide();
|
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() {
|
void Handle_One_Event() {
|
||||||
short chr,chr2;
|
short chr,chr2;
|
||||||
long menu_choice;
|
long menu_choice;
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
#include "restypes.hpp"
|
#include "restypes.hpp"
|
||||||
#include "tarball.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 cScenario scenario;
|
||||||
extern sf::Texture items_gworld,tiny_obj_gworld,fields_gworld,roads_gworld,boom_gworld,missiles_gworld;
|
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;
|
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";
|
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){
|
bool load_scenario(fs::path file_to_load, bool skip_strings){
|
||||||
short i,n;
|
short i,n;
|
||||||
bool file_ok = false;
|
bool file_ok = false;
|
||||||
|
@@ -30,6 +30,7 @@ bool load_party(fs::path file_to_load);
|
|||||||
bool save_party(fs::path dest_file);
|
bool save_party(fs::path dest_file);
|
||||||
|
|
||||||
void init_directories(const char* exec_path);
|
void init_directories(const char* exec_path);
|
||||||
|
void check_for_intel();
|
||||||
|
|
||||||
std::string read_maybe_quoted_string(std::istream& from);
|
std::string read_maybe_quoted_string(std::istream& from);
|
||||||
std::string maybe_quote_string(std::string which);
|
std::string maybe_quote_string(std::string which);
|
||||||
|
Reference in New Issue
Block a user