-bin_PROGRAMS = stepmania
+bin_PROGRAMS = openitg
TESTS =
tests: $(TESTS)
if BUILD_TESTS
LoadingWindow = arch/LoadingWindow/LoadingWindow.h \
arch/LoadingWindow/LoadingWindow_Null.h
+#Make sure any dependencies on these data structure are wrapped.
#if HAVE_LIBUSB
LIBS += -lusb
DataStructures += io/USBDriver.cpp io/USBDriver.h \
if LINUX
MemoryCard += arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp arch/MemoryCard/MemoryCardDriverThreaded_Linux.h
-InputHandler += arch/InputHandler/InputHandler_Linux_Joystick.h arch/InputHandler/InputHandler_Linux_Joystick.cpp \
- arch/InputHandler/InputHandler_Linux_PIUIO.h arch/InputHandler/InputHandler_Linux_PIUIO.cpp
+InputHandler += arch/InputHandler/InputHandler_Linux_Joystick.h arch/InputHandler/InputHandler_Linux_Joystick.cpp
+
+# These cannot build without USBDriver, which depends on libusb
+#if HAVE_LIBUSB
+InputHandler += arch/InputHandler/InputHandler_Linux_PIUIO.h \
+ arch/InputHandler/InputHandler_Linux_PIUIO.cpp
+#endif
+
endif
Arch = $(LoadingWindow) $(Sound) $(ArchHooks) $(InputHandler) $(MovieTexture) \
$(XLIBS) \
$(srcdir)/libresample/libresample.a
-stepmania_SOURCES = $(main_SOURCES)
-stepmania_LDADD = $(main_LDADD)
+openitg_SOURCES = $(main_SOURCES)
+openitg_LDADD = $(main_LDADD)
# $(srcdir)/ffmpeg/lib/libavcodec.a $(srcdir)/ffmpeg/lib/libavformat.a
if HAVE_GTK
* to support problems in dev builds since they're not *
* official releases and likely have bugs we've fixed. */
-#define PRODUCT_NAME "In The Groove 2"
-#define PRODUCT_VER "alpha 3 DEV-3"
+/* I guess this is the official name now. :P --Vyhd */
+#define PRODUCT_NAME "OpenITG"
+#define PRODUCT_VER "alpha 3"
#define PRODUCT_SERIAL "ITG-C-12222007-529-3"
#define PRODUCT_NAME_VER PRODUCT_NAME " " PRODUCT_VER
; Included by the NSIS installer script
; Don't forget to also change ProductInfo.h!
-!define PRODUCT_NAME "In The Groove 2"
+!define PRODUCT_NAME "OpenITG"
!define PRODUCT_VER "alpha 3"
; !define PRODUCT_VER "3.9 alpha 23"
!define PRODUCT_NAME_VER "${PRODUCT_NAME} ${PRODUCT_VER}"
; String used for the install directory and registry locations
; Official releases = "StepMania"; intermediate releases = "StepMania CVS".
-!define PRODUCT_ID "In The Groove 2 alpha3"
+!define PRODUCT_ID "OpenITG alpha3"
DIR *pDir = opendir(root+sPath);
if( pDir == NULL )
{
- LOG->MapLog("opendir " + root+sPath, "Couldn't opendir(%s%s): %s", root.c_str(), sPath.c_str(), strerror(errno) );
+ // HACK: these messages are annoying me. Keep them out. -- Vyhd
+ if( errno != 2 ) // "No such file or directory"
+ LOG->MapLog("opendir " + root+sPath, "Couldn't opendir(%s%s): %s", root.c_str(), sPath.c_str(), strerror(errno) );
+
return;
}
#include "RageFileDriverZip.h"
#include "XmlFile.h"
+#include "StepMania.h" // For ExitAndReboot()
+
#include "Foreach.h" // Foreach loops without the command is hard.
#include "MemoryCardManager.h" // Where else are we getting the patch from?
#include "GameState.h" // Check which USB...
ScreenArcadePatch::~ScreenArcadePatch()
{
- LOG->Warn( "ScreenArcadePatch::~ScreenArcadePatch() %i", (int)g_doReboot );
- if (g_doReboot)
- {
- LOG->Warn("ZOMG REBOOTING");
- struct stat ncr; // lol get it?
- if ( stat("/tmp/no-crash-reboot", &ncr) != 0 )
- {
- LOG->Warn("Hard reboot commence...");
- reboot(RB_AUTOBOOT);
- }
- else
- {
- LOG->Warn("SM Quit commence...");
- GAMESTATE->EndGame();
- //exit(0);
- }
- }
- else
- {
- LOG->Warn("ZOMG NOT REBOOTING");
- }
+ LOG->Trace( "ScreenArcadePatch::~ScreenArcadePatch() %i", (int)g_doReboot );
+
+ if( g_doReboot )
+ ExitAndReboot();
}
void ScreenArcadePatch::Init()
bChecking = false;
m_PatchStatus = &m_Status;
- g_doReboot = false;
-
+ g_doReboot = true;
}
void ScreenArcadePatch::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
#include <windows.h>
#endif
+#if defined(UNIX)
+#include <sys/reboot.h>
+#include <cerrno>
+#endif
+
#define ZIPS_DIR "Packages/"
int g_argc = 0;
SAFE_DELETE( HOOKS );
}
+/* Does exactly what it suggests. Use with caution; people generally
+ * don't like having their computers restarted unexpectedly.
+
+ * To simply end StepMania instead of rebooting, have one of these filenames:
+ * "/tmp/no-crash-reboot" - Unix-like only, for ITG compatibility
+ * "Data/no-reboot" - usable for all platforms
+ */
+void ExitAndReboot()
+{
+ /* Should we reboot or just quit? */
+ if( IsAFile("Data/no-reboot") || IsAFile("/rootfs/tmp/no-crash-reboot") )
+ {
+ LOG->Warn( "Found no-reboot file. Exiting OpenITG." );
+ ExitGame();
+ return;
+ }
+
+ LOG->Warn( "Could not find no-reboot file. Rebooting." );
+
+ bool bRestart = false;
+ CString sError;
+
+#if defined(UNIX)
+ /* If reboot() succeeds, we will never pass here. */
+ bRestart = !reboot( RB_AUTOBOOT );
+
+ sError = strerror(errno);
+#elif defined(WIN32) && !defined(XBOX)
+ bRestart = ExitWindowsEx( EWX_REBOOT | EWX_FORCEIFHUNG,
+ SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_MAINTENANCE
+ | SHTDN_REASON_FLAG_PLANNED ); // returns "0" on failure only
+
+ /* This will be more useful to Windows users than me... */
+ sError = ssprintf( "%#x", (unsigned int)GetLastError() );
+#else
+ sError = "function not implemented for your OS.";
+ bRestart = false;
+#endif
+
+ CString sMessage = ssprintf( "Could not reboot: %s", sError.c_str() );
+
+ /* Windows restarts asynchronously, so bRestart can be true and
+ * we'll still be here. Wrap this for false conditions, so any
+ * true conditions can fallthrough to the clean exit. */
+ if( !bRestart )
+ {
+ Dialog::Error( sMessage );
+ exit( 1 );
+ }
+
+ exit( 0 );
+}
+
/* Cleanly shut down, show a dialog and exit the game. We don't go back
* up the call stack, to avoid having to use exceptions. */
void HandleException( CString error )
int argc = 1;
char *argv[] = {"default.xbe"};
#endif
-
+
g_argc = argc;
g_argv = argv;
}
MountTreeOfZips( ZIPS_DIR );
+ // TODO: soft-code this!
{
CStringArray dzips;
void NORETURN HandleException( CString error );
void ExitGame();
void ResetGame();
+void ExitAndReboot();
void SaveGamePrefsToDisk();
void ChangeCurrentGame( const Game* g );
void FocusChanged( bool bHasFocus );
#include <cerrno>
+// dumb workaround...dunno if it'll compile. -- Vyhd
+#define HAVE_IMG_CONVERT
+
#if defined(WIN32) && !defined(XBOX)
#include <windows.h>
#endif
#include "Backtrace.h"
#include "BacktraceNames.h"
+#include "RageLog.h" /* for RageLog::GetAdditionalLog, etc. only */
#include "RageUtil.h"
#include "CrashHandler.h"
#include "CrashHandlerInternal.h"
-#include "RageLog.h" /* for RageLog::GetAdditionalLog, etc. only */
-#include "ProductInfo.h"
+#include "ProductInfo.h" /* For CRASH_REPORT_URL */
+#include "StepMania.h" /* To call ExitAndReboot() */
#if defined(DARWIN)
#include "archutils/Darwin/Crash.h"
/* keep going */
}
- const char *home = getenv( "HOME" );
-
- // I make my first move here...
-// CString sCrashInfoPath = "/tmp"; // Commented...
- CString sCrashInfoPath = "/stats"; // Yeaaa ITG2AC Style!
+ // We don't need the file/ext, but they're required args.
+ CString sPath, sDir, sFile, sExt;
- if( home )
- sCrashInfoPath = home;
-
- // This is where I make my move!
- // -- Matt1360
-// sCrashInfoPath += "/crashinfo.txt"; // Commented...
+ sPath = g_pCrashHandlerArgv0;
+ splitpath( sPath, sDir, sFile, sExt );
+
+ CString sCrashInfoPath = sDir + "Stats";
- // Make the variable
time_t seconds;
seconds = time( NULL );
"\n"
"Please report a bug at:\n"
"\n"
- " http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366\n"
+ " " CRASH_REPORT_URL "\n"
"\n"
);
+
#endif
+
+ ExitAndReboot(); // restart
}
//#include <stdio.h>
#include <stdarg.h>
#include <crtdbg.h>
+#include <time.h> // needed for timestamping
#include <windows.h>
#include <tlhelp32.h>
{
char szModName2[MAX_PATH];
- SpliceProgramPath(szModName2, sizeof szModName2, "../crashinfo.txt");
+ /* Set up a timestamp for the crashlog. */
+ time_t seconds;
+ seconds = time( NULL );
+
+ char sCrashLog[32];
+ sprintf( sCrashLog, "../Stats/crashlog-%ld.txt", seconds );
+
+ SpliceProgramPath(szModName2, sizeof szModName2, sCrashLog);
HANDLE hFile = CreateFile(szModName2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == hFile)