Home » MODDING HQ 1.13 » v1.13 Idea Incubation Lab » [Linux] ja2 1.13 linux port (alpha release)
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #179622]
|
Mon, 31 March 2008 16:02
|
|
InHuMan |
|
Messages:44
Registered:November 2006 Location: Czech Republic |
|
|
@Lesh 2: Ok, my fault...
Another bug - History and finances in laptop do not work.
These patches should fix it:
Index: ../src/sgp/file_man.cpp
===================================================================
--- ../src/sgp/file_man.cpp (revision 1907)
+++ ../src/sgp/file_man.cpp (working copy)
@@ -435,6 +435,13 @@
result = handler != NULL;
useSLF = FALSE;
}
+ else if (uiOptions & FILE_ACCESS_APPEND)
+ {
+ // open for append through PhysFS
+ handler = PHYSFS_openAppend(name);
+ result = handler != NULL;
+ useSLF = FALSE;
+ }
else
{
// open for read through PhysFS first, then try SLF
Index: ../src/laptop/finances.cpp
===================================================================
--- ../src/laptop/finances.cpp (revision 1941)
+++ ../src/laptop/finances.cpp (working copy)
@@ -219,6 +219,8 @@
// clear list
ClearFinanceList( );
+
+ OpenAndReadFinancesFile();
pFinance=pFinanceListHead;
@@ -1215,11 +1217,11 @@
while( pFinanceList != NULL )
{
// write in other data
- FileRead( hFileHandle, &pFinanceList->ubCode, sizeof(UINT8), NULL );
- FileRead( hFileHandle, &pFinanceList->ubSecondCode, sizeof(UINT8), NULL );
- FileRead( hFileHandle, &pFinanceList->uiDate, sizeof(UINT32), NULL );
- FileRead( hFileHandle, &pFinanceList->iAmount, sizeof(INT32), NULL );
- FileRead( hFileHandle, &pFinanceList->iBalanceToDate, sizeof(INT32), NULL );
+ FileWrite( hFileHandle, &pFinanceList->ubCode, sizeof(UINT8), NULL );
+ FileWrite( hFileHandle, &pFinanceList->ubSecondCode, sizeof(UINT8), NULL );
+ FileWrite( hFileHandle, &pFinanceList->uiDate, sizeof(UINT32), NULL );
+ FileWrite( hFileHandle, &pFinanceList->iAmount, sizeof(INT32), NULL );
+ FileWrite( hFileHandle, &pFinanceList->iBalanceToDate, sizeof(INT32), NULL );
pFinanceList = pFinanceList->Next;
}
Index: ../src/laptop/history.cpp
===================================================================
--- ../src/laptop/history.cpp (revision 1900)
+++ ../src/laptop/history.cpp (working copy)
@@ -1568,7 +1568,7 @@
// open file
- hFileHandle=FileOpen( gzHistoryDataFile, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE);
+ hFileHandle=FileOpen( gzHistoryDataFile, FILE_ACCESS_APPEND, FALSE);
// if no file exits, do nothing
if(!hFileHandle)
EDIT: Maybe is a good idea to rewrite and clean some function in laptop/finances.cpp file...
Report message to a moderator
|
Corporal
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #179639]
|
Mon, 31 March 2008 20:15
|
|
Lesh 2 |
|
Messages:107
Registered:September 2006 Location: Izhevsk, Russia |
|
|
I hope you made reuse of append file access, appeared recently, to fix these bugs. I was slightly confused, when I saw physfs append function call, written recently, in your patch.
Ok, patched. Need to test!
Quote:EDIT: Maybe is a good idea to rewrite and clean some function in laptop/finances.cpp file...
I believe, most of the game code requires refactoring, but my resources are limited. :wb:
Report message to a moderator
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #179761]
|
Tue, 01 April 2008 22:40
|
|
InHuMan |
|
Messages:44
Registered:November 2006 Location: Czech Republic |
|
|
Another bug - I can't type in nickname field in IMP begin screen. (It is strange similar bug was fixed 11.11.2007 and I am sure, that "nickname type in" were functional).
Quote:Index: imp_begin_screen.cpp
===================================================================
--- imp_begin_screen.cpp (revision 1900)
+++ imp_begin_screen.cpp (working copy)
@@ -669,7 +669,7 @@
}
// make sure we haven't moved too far
- if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X )
+ if( ( uiNickNameCursorPosition + CharPixLength( (CHAR16)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X )
{
// do nothing for now, when pop up is in place, display
break;
[Updated on: Fri, 13 June 2008 15:38] by Moderator Report message to a moderator
|
Corporal
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #180041]
|
Thu, 03 April 2008 20:59
|
|
InHuMan |
|
Messages:44
Registered:November 2006 Location: Czech Republic |
|
|
Found another bug - If ja2.ini doesn't exist, game will crash with segmentation fault
This patch fix it and load default settings (800x600, windowed)
Index: sgp.cpp
===================================================================
--- sgp.cpp (revision 1980)
+++ sgp.cpp (working copy)
@@ -293,6 +293,8 @@
// Runtime settings - for now use INI file - later use registry
STRING512 INIFile; // Path to the ini file
CFG_File cfg;
+
+ iResolution = -1;
// Get Executable Directory
GetHomeDirectory( INIFile );
@@ -300,26 +302,34 @@
strcat(INIFile, "ja2.ini");
printf("Reading run-time settings from: %s
", INIFile);
- if ( CFG_OpenFile( INIFile, &cfg ) != CFG_OK )
+ if ( CFG_OpenFile( INIFile, &cfg ) == CFG_OK )
{
- printf("Failed to open run-time ini
");
+ if ( CFG_SelectGroup( "Ja2 Settings", CFG_False ) == CFG_OK )
+ {
+ gfFullScreen = CFG_ReadInt("FULLSCREEN", 0);
+#ifndef JA2EDITOR
+ iResolution = CFG_ReadInt("SCREEN_RESOLUTION", 1);
+#else
+ iResolution = CFG_ReadInt("EDITOR_SCREEN_RESOLUTION", 1);
+#endif
+
+ }
+ else
+ {
+ printf("Failed to select Ja2 Settings group in ini
");
+
+ }
+
+ CFG_CloseFile( &cfg );
+
}
-
- if ( CFG_SelectGroup( "Ja2 Settings", CFG_False ) != CFG_OK )
+ else
{
- printf("Failed to select Ja2 Settings group in ini
");
+ printf("Failed to open run-time ini
");
}
-
- iResolution = -1;
-
-#ifndef JA2EDITOR
- iResolution = CFG_ReadInt("SCREEN_RESOLUTION", 1);
-#else
- iResolution = CFG_ReadInt("EDITOR_SCREEN_RESOLUTION", 1);
-#endif
- int iResX;
+ int iResX;
int iResY;
switch (iResolution)
@@ -355,9 +365,6 @@
SCREEN_HEIGHT = GetPrivateProfileInt( "SGP", "HEIGHT", iResY, INIFile );
#endif
- gfFullScreen = CFG_ReadInt("FULLSCREEN", 0);
-
- CFG_CloseFile( &cfg );
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
Report message to a moderator
|
Corporal
|
|
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #180957]
|
Fri, 11 April 2008 22:54
|
|
InHuMan |
|
Messages:44
Registered:November 2006 Location: Czech Republic |
|
|
Another bug - Wrong re-initialization of history. (Start game -> quit to main menu -> start new game). In pHistoryListHead remains data from previous game. This will cause, that first record is displayed twice.
Index: history.cpp
===================================================================
--- history.cpp (revision 2006)
+++ history.cpp (working copy)
@@ -230,7 +230,7 @@
}
void GameInitHistory()
-{
+{ ClearHistoryList();
OpenAndWriteHistoryFile();
AddHistoryToPlayersLog(HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO, 0, GetWorldTotalMin( ), -1, -1);
}
Another bug - First record in History has date from previous game. (Load game -> quit to main menu -> start new game)
Index: strategic/quests.cpp
===================================================================
--- strategic/quests.cpp (revision 2006)
+++ strategic/quests.cpp (working copy)
@@ -1296,8 +1296,9 @@
memset(gubQuest, 0, sizeof(gubQuest));
memset(gubFact, 0, sizeof(gubFact));
+ // InHuMan: This is not needed anymore
// semi-hack to make the letter quest start right away
- CheckForQuests( 1 );
+ //CheckForQuests( 1 );
if ( gGameOptions.ubGameStyle == STYLE_SCIFI )
{
@@ -1323,19 +1324,20 @@
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay );
#endif
-
- // -------------------------------------------------------------------------------
+
+ // InHuMan: Moved to InitNewGame() in game_init.cpp
+ // -------------------------------------------------------------------------------
// QUEST 0 : DELIVER LETTER
// -------------------------------------------------------------------------------
// The game always starts with DELIVER LETTER quest, so turn it on if it hasn't
// already started
- if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
- {
- StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
-#ifdef TESTQUESTS
- ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
-#endif
- }
+// if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
+// {
+// StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
+//#ifdef TESTQUESTS
+// ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
+//#endif
+// }
// This quest gets turned OFF through conversation with Miguel - when user hands
// Miguel the letter
Index: strategic/game_init.cpp
===================================================================
--- strategic/game_init.cpp (revision 2006)
+++ strategic/game_init.cpp (working copy)
@@ -405,15 +405,16 @@
// IF our first time, go into laptop!
if ( gubScreenCount == 0 )
{
- DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: first time: init laptop");
+ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewGame: first time: init strategic layer");
+
+ printf("Initializing strategic layer
");
+ InitStrategicLayer();
+
printf("Initializing laptop
");
-
- //Init the laptop here
InitLaptopAndLaptopScreens();
- printf("Initializing strategic layer
");
- InitStrategicLayer();
+
// Set new game flag
SetLaptopNewGameFlag( );
@@ -431,9 +432,13 @@
{
AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ), -1 );
}
+
+ // InHuMan: Start QUEST 0 : DELIVER LETTER
+ // This quest gets turned OFF through conversation with Miguel - when user hands
+ // Miguel the letter
+ StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
-
// ATE: Set starting cash....
switch( gGameOptions.ubDifficultyLevel )
{
Report message to a moderator
|
Corporal
|
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #181098]
|
Sat, 12 April 2008 19:32
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
InHuManWell, loading times are smaller, animations and fading in menu are faster and smoother.
The latter is explained easily: There is an in-game clock (accessed via GetJA2Clock()), which gets updated in a separate thread. The main thread uses this clock to time several animations (like the zoom in of the laptop). So the main thread is in a busy loop redrawing the animation and thus starves the other thread, which should update the clock. The animation takes one second according to this clock, but because its update cycles are starved, it takes much longer in reality. Depending on the threading policy this effect is more dramatic one some systems than others. This pseudo-clock is one of the many conceptual WTFs in the JA2 source code and is of course broken by misdesign.
I resolved this particular issue for the zoom/fade animations in r1426 and further corrected many problems like this, memory leaks, out of bounds accesses, crashes, graphics glitches etc. and cleaned up small parts of the code (to this date the source code has about 140.000 lines of code less than the vanilla source code!), but there is still much to do to improve stability and maintainability.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #181194]
|
Sun, 13 April 2008 13:32
|
|
InHuMan |
|
Messages:44
Registered:November 2006 Location: Czech Republic |
|
|
Another bug - Shade tables regenerating every game. Bug from revision 1577.
Index: shade_table_util.cpp
===================================================================
--- shade_table_util.cpp (revision 2017)
+++ shade_table_util.cpp (working copy)
@@ -32,8 +32,6 @@
void DetermineRGBDistributionSettings()
{
- STRING512 DataDir;
- STRING512 TempDir;
STRING512 file1, file2;
UINT32 uiRBitMask, uiGBitMask, uiBBitMask;
UINT32 uiPrevRBitMask, uiPrevGBitMask, uiPrevBBitMask;
@@ -110,7 +108,7 @@
{ //The RGB distribution is going to be saved in a tiny file for future reference. As long as the
//RGB distribution never changes, the shade table will grow until eventually, all tilesets are loaded,
//shadetables generated and saved in this directory.
- hfile = FileOpen( file2, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
+ hfile = FileOpen( file1, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if( !hfile )
{
AssertMsg( 0, "Couldn't create RGBDist.dat for writing!" );
Report message to a moderator
|
Corporal
|
|
|
|
|
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #182064]
|
Fri, 18 April 2008 20:23
|
|
cdunigan |
|
Messages:132
Registered:September 2007 Location: Madison, Wisconsin, USA |
|
|
TronJAPHI'm going to get the new development branch and start testing again, especially since you're helping so much, InHuman and Tron.
I want to emphasize, that I maintain a separate project (see signature), which is not affiliated with JA2 1.13 in any way. In fact this JA2 1.13 Linux port uses parts of the code I wrote.
Quote:The argument for using them is that "./configure; make; make install" is practically hardwired into every Linux user who doesn't do yum or apt.
autotools are more trouble than they're worth. I just use a small Makefile, which works well on several configurations (FreeBSD, several Linuxes, Windows with MinGW/MSYS, OSX)
I hope I didn't offend you. I already knew about Stracciatella, I just saw your posts here and assumed you'd decided to help Lesh, too. Sorry about that. And I don't mean to get into a debate over the value of autotools, I was just pointing out that many users will expect them. I'll happily accept whatever Lesh decides to do.
Report message to a moderator
|
Sergeant
|
|
|
|
|
|
|
Re: [Linux] ja2 1.13 linux port (alpha release)[message #182088]
|
Fri, 18 April 2008 21:25
|
|
Tron |
|
Messages:225
Registered:August 2007 Location: Germany |
|
|
JAPHmake: *** No rule to make target `../../src/SDL/SDL.h', needed by `ani_view_screen.o'. Stop.
This looks like it searches for a SDL header in the source tree of JA2. This seems wrong.
[Updated on: Fri, 18 April 2008 21:25] by Moderator Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
Goto Forum:
Current Time: Fri Mar 29 09:27:26 GMT+2 2024
Total time taken to generate the page: 0.02512 seconds
|