Whitespace changes only, to make this a bit more like the rest of the
code. (I can read it just fine, but it takes a bit of a mind state shift to read code in a different style.) No functional changes, since I don't have a Mac to test them.
This commit is contained in:
@@ -29,7 +29,8 @@ static queue<CString> crashLog;
|
|||||||
static vector<CString> staticLog;
|
static vector<CString> staticLog;
|
||||||
static CString additionalLog;
|
static CString additionalLog;
|
||||||
|
|
||||||
ArchHooks_darwin::ArchHooks_darwin() {
|
ArchHooks_darwin::ArchHooks_darwin()
|
||||||
|
{
|
||||||
long response;
|
long response;
|
||||||
CString error = "";
|
CString error = "";
|
||||||
OSErr err = Gestalt(gestaltSystemVersion, &response);
|
OSErr err = Gestalt(gestaltSystemVersion, &response);
|
||||||
@@ -39,14 +40,16 @@ ArchHooks_darwin::ArchHooks_darwin() {
|
|||||||
else if (response < kMacOSX_10_2)
|
else if (response < kMacOSX_10_2)
|
||||||
error = "StepMania is not supported on any version of Mac OS X "
|
error = "StepMania is not supported on any version of Mac OS X "
|
||||||
"other than OS X 10.2.x. This is not a bug.";
|
"other than OS X 10.2.x. This is not a bug.";
|
||||||
if (error != "") {
|
if (error != "")
|
||||||
|
{
|
||||||
MessageBoxOK(error, "");
|
MessageBoxOK(error, "");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
InstallExceptionHandler(HandleException);
|
InstallExceptionHandler(HandleException);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_darwin::Log(CString str, bool important) {
|
void ArchHooks_darwin::Log(CString str, bool important)
|
||||||
|
{
|
||||||
if (important)
|
if (important)
|
||||||
staticLog.push_back(str);
|
staticLog.push_back(str);
|
||||||
|
|
||||||
@@ -56,14 +59,16 @@ void ArchHooks_darwin::Log(CString str, bool important) {
|
|||||||
crashLog.push(str);
|
crashLog.push(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_darwin::AdditionalLog(CString str) {
|
void ArchHooks_darwin::AdditionalLog(CString str)
|
||||||
|
{
|
||||||
additionalLog = str;
|
additionalLog = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CASE_GESTALT_M(str,code,result) case gestalt##code: str = result; break
|
#define CASE_GESTALT_M(str,code,result) case gestalt##code: str = result; break
|
||||||
#define CASE_GESTALT(str,code) CASE_GESTALT_M(str, code, #code)
|
#define CASE_GESTALT(str,code) CASE_GESTALT_M(str, code, #code)
|
||||||
|
|
||||||
void ArchHooks_darwin::DumpDebugInfo() {
|
void ArchHooks_darwin::DumpDebugInfo()
|
||||||
|
{
|
||||||
CString date = __DATE__;
|
CString date = __DATE__;
|
||||||
CString systemVersion;
|
CString systemVersion;
|
||||||
long ram;
|
long ram;
|
||||||
@@ -227,7 +232,8 @@ void ArchHooks_darwin::DumpDebugInfo() {
|
|||||||
dDescription.c_str(), dVersion.c_str(), dDate.c_str(), dDeviceID.c_str());
|
dDescription.c_str(), dVersion.c_str(), dDate.c_str(), dDeviceID.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID) {
|
void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID)
|
||||||
|
{
|
||||||
bool allowHush = ID != "";
|
bool allowHush = ID != "";
|
||||||
|
|
||||||
if (allowHush && MessageIsIgnored(ID))
|
if (allowHush && MessageIsIgnored(ID))
|
||||||
@@ -255,7 +261,8 @@ void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID) {
|
|||||||
ASSERT(err == noErr);
|
ASSERT(err == noErr);
|
||||||
|
|
||||||
RunStandardAlert(dialog, NULL, &unused);
|
RunStandardAlert(dialog, NULL, &unused);
|
||||||
if (allowHush && GetControl32BitValue(box)){
|
if (allowHush && GetControl32BitValue(box))
|
||||||
|
{
|
||||||
LOG->Trace("Ignore dialog ID, \"%s\"", ID.c_str());
|
LOG->Trace("Ignore dialog ID, \"%s\"", ID.c_str());
|
||||||
IgnoreMessage(ID);
|
IgnoreMessage(ID);
|
||||||
}
|
}
|
||||||
@@ -264,7 +271,8 @@ void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID) {
|
|||||||
CFRelease(boxName);
|
CFRelease(boxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString sMessage, CString ID) {
|
ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString sMessage, CString ID)
|
||||||
|
{
|
||||||
SInt16 button;
|
SInt16 button;
|
||||||
/* I see no reason for an abort button */
|
/* I see no reason for an abort button */
|
||||||
CFStringRef r = CFStringCreateWithCString(NULL, "Retry", kCFStringEncodingASCII);
|
CFStringRef r = CFStringCreateWithCString(NULL, "Retry", kCFStringEncodingASCII);
|
||||||
@@ -298,13 +306,15 @@ ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString
|
|||||||
|
|
||||||
#define CASE_CODE(code,addr) case k##code: strcpy((addr),#code); break
|
#define CASE_CODE(code,addr) case k##code: strcpy((addr),#code); break
|
||||||
|
|
||||||
OSStatus HandleException(ExceptionInformation *theException) {
|
OSStatus HandleException(ExceptionInformation *theException)
|
||||||
|
{
|
||||||
InstallExceptionHandler(NULL); /* Remove this handler */
|
InstallExceptionHandler(NULL); /* Remove this handler */
|
||||||
|
|
||||||
FILE *fp = fopen("crashinfo.txt", "w");
|
FILE *fp = fopen("crashinfo.txt", "w");
|
||||||
char code[31];
|
char code[31];
|
||||||
|
|
||||||
switch (theException->theKind) {
|
switch (theException->theKind)
|
||||||
|
{
|
||||||
CASE_CODE(UnknownException, code);
|
CASE_CODE(UnknownException, code);
|
||||||
CASE_CODE(IllegalInstructionException, code);
|
CASE_CODE(IllegalInstructionException, code);
|
||||||
CASE_CODE(TrapException, code);
|
CASE_CODE(TrapException, code);
|
||||||
@@ -331,11 +341,13 @@ OSStatus HandleException(ExceptionInformation *theException) {
|
|||||||
"Preferences->Crashes->Enable crash reporting.\n"
|
"Preferences->Crashes->Enable crash reporting.\n"
|
||||||
"************************\n\n"
|
"************************\n\n"
|
||||||
"Static log:\n", code);
|
"Static log:\n", code);
|
||||||
|
|
||||||
unsigned size = staticLog.size();
|
unsigned size = staticLog.size();
|
||||||
for (unsigned i=0; i<size; ++i)
|
for (unsigned i=0; i<size; ++i)
|
||||||
fprintf(fp, "%s\n", staticLog[i].c_str());
|
fprintf(fp, "%s\n", staticLog[i].c_str());
|
||||||
fprintf(fp, "\nPartial log:\n");
|
fprintf(fp, "\nPartial log:\n");
|
||||||
while (!crashLog.empty()) {
|
while (!crashLog.empty())
|
||||||
|
{
|
||||||
CString s = crashLog.front();
|
CString s = crashLog.front();
|
||||||
fprintf(fp, "%s\n", s.c_str());
|
fprintf(fp, "%s\n", s.c_str());
|
||||||
crashLog.pop();
|
crashLog.pop();
|
||||||
@@ -344,9 +356,11 @@ OSStatus HandleException(ExceptionInformation *theException) {
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* Check for sh */
|
/* Check for sh */
|
||||||
if (system(NULL)) {
|
if (system(NULL))
|
||||||
|
{
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
if (getcwd(path, MAXPATHLEN)) {
|
if (getcwd(path, MAXPATHLEN))
|
||||||
|
{
|
||||||
int pos = strlen(path);
|
int pos = strlen(path);
|
||||||
strcpy(&path[pos], "/crashinfo.txt");
|
strcpy(&path[pos], "/crashinfo.txt");
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user