..:: PCSX2 Forums ::..

Full Version: Linux - Compile Guide and Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Quote:Sweet, I'll test them tonight.

Do not hesitate to report any issue or suggestion !

May be it could be interesting to open a new thread for debian packaging stuff (do not know the good place, developper ?).
Hi Arcum,

Well It takes less time than I expected. I extended the current plugin API with a SetLogFolder function. It basically work as setSettingsDir function. Note I also add a fallback function so it does not break compatibility (I hope). There are still 2 open questions.

1/ Who must handle the following case: calling the callback without changing the directory ? Caller or plugins ? LIke setting I add some test to a m_LogFolder variable to ensure the caller does not recall the callback function when dir is not updated. But in my opinion it is better to let plugins do the job.

2/ confined exceptions to plugins. I read common/include/PluginCallbacks.h (line 63). If I understand correctly std::string (it is equivalent to 'string' ?) must be contained within a try block. But I do not know how to properly code it. An example will be welcome.

********* Patches descriptions (based agains rev 3087)
+ 45_add_zeropad_log_api.patch: Example of the new function implementation in a plugins. Usefull to do some test.

+ 46_add_main_log_api.patch: Core implementation in the emulator of the new function.
PluginManager:WackoendLogFolder -> call plugins callback to send the directory.
PluginManager:WackoetLogFolder -> Check if folder have changed, and call SendLogFolder

+ 47_use_log_api.patch: Call the new API function. I create a new function GetLogFolder to get the current user Log dir configuration. Then it call SetLogFolder into both Init and Open phases.
Note I previously also added into the Load phase (like SetSettingsFolder) but plugins are not yet loaded. So emulator thinks it already send the dir to the plugins, but they never received it... And so emulator does not resend it... (see point 1 above).

Let's call the code a proof of concept. Any suggestion or issue are welcome.
(05-28-2010, 05:51 PM)gregory Wrote: [ -> ]1/ Who must handle the following case: calling the callback without changing the directory ? Caller or plugins ? LIke setting I add some test to a m_LogFolder variable to ensure the caller does not recall the callback function when dir is not updated. But in my opinion it is better to let plugins do the job.

I would prefer both Settings and Log folder APIs work the same way, for consistency. There really shouldn't be any issues

(05-28-2010, 05:51 PM)gregory Wrote: [ -> ]2/ confined exceptions to plugins. I read common/include/PluginCallbacks.h (line 63). If I understand correctly std::string (it is equivalent to 'string' ?) must be contained within a try block. But I do not know how to properly code it. An example will be welcome.

In practice it doesn't really matter. The only thing the STL containers will throw exceptions for are new/alloc failures, and really if those fail the app is screwed anyway and is doomed to crash/fail regardless. This is especially true in a multithreaded gui environment -- can't even transport out-of-memory messages to the main thread since cross-thread transport of any sort of useful information requires a series of dynamic allocations anyway.

If you're allocating LARGE chunks of memory, where recoverable out-of-memory exceptions are possible, then yeah you'll want to make sure and trap/handle them. But for basic uses of std::string called primarily during app startup? It would be 'correct' to handle them, but not really useful.

I'll include an example anyway, for sake of learning. There's no need to clutter the code with it, though:

Code:
void CALLBACK PADfail( const char* woot )
{
    try {
        std:string s( woot );
        s += "text!"
        m_SaveItForLater = s;
    }
    catch( std::bad_alloc& ex )
    {
        // m_SaveItForLater is probably invalid/unallocated, so its not
        // like this is a recoverable error.  Probably should assert.

        assert(false);
    }
    catch( std::exception& ex )
    {
        // ..pandemic catch-all clause..
        // Some other non-alloc error.  Typically these aren't thrown by any
        // STL implementations, unless explicitly enabled via compiler define.
        // ... probably should just assert, since whatever exceptioned is
        // a critical logic error.

        assert(false);
    }
}

Note that I don't use catch(...) -- it has differing behavior cross-compilers, and usually isn't very helpful since nothing in STL throws anything that doesn't derive from std::exception.

(05-28-2010, 05:51 PM)gregory Wrote: [ -> ]Note I previously also added into the Load phase (like SetSettingsFolder) but plugins are not yet loaded. So emulator thinks it already send the dir to the plugins, but they never received it... And so emulator does not resend it... (see point 1 above).

It really should work fine from the Load phase. The reason it didn't for you is because there's also a call to SendSettingsFolder() in the PluginManager's parent class. I'll add a matching SendLogFolder() call there, and that should have it all working fine. Smile

(I'll apply the patch shortly -- really this is needed for both Windows and Linux)
Most of the patch applied. I didn't apply the part pertaining to zeropad, since I can't test it properly, etc. from windows. Smile

@Arcum : I'll handle updating SPU2-X to use the log dir. Its logging code is a bit of a mess, and I need to get rid of the archaic Unicode converter I hacked in years ago (prior to wx), among other things.

All other plugins that have logging (GSdx for example doesn't log anything) can be implemented same as gregory's patch, and same as for the SetSettingsDir. If a plugin doesn't have logging, then there's no need to add the function.
I tested the zeropad one, and have applied it, after fixing it. (I found a file named "logpadLog.txt" in the pcsx2 directory Smile )

And I'll leave spu2-x up to you.

Btw, I've been wondering about the code in Decoder.cpp in spu2-x. Are there any particular games that use it? I tried commenting out all calls to functions in it once, and didn't particularly notice the difference...
Ok nice.

Thanks for the catch example.

Sorry for logpadLog.txt. I play with both string and std::string for string s_strLogPath. In the end I just mess up.
Don't worry about it. I'm fairly sure I've made the same mistake before in pcsx2. Of course, these days in pcsx2, we'd just use Path::Combine, but I didn't really feel like adding Utilities as a prerequisite for zeropad... (onepad, I might, since that's in a slightly more active state of development.)
i'm not sure if I'm just too stupid to get it running, but... I just downloaded the new version 0.9.7 from the main page and I'm running kubuntu 10.04 x64.

when starting pcsx2 I get the following output:

$ ./pcsx2
./pcsx2: /usr/lib32/libz.so.1: version `ZLIB_1.2.3.5' not found (required by ./pcsx2)
./pcsx2: /usr/lib32/libz.so.1: version `ZLIB_1.2.3.3' not found (required by ./pcsx2)

so, okay, let's see...
$ ls /usr/lib32/libz*
/usr/lib32/libz.a /usr/lib32/libz.so /usr/lib32/libz.so.1 /usr/lib32/libz.so.1.2.3.3

umm... these file are available? so why is pcsx2 complaining? and more importantly: how do i make it stop?
Hello,

In fact you does not have the good version of zlib. You actually have version 1.2.3.3 unfortunately it seems the binary has been compiled with version 1.2.3.5.

You have 2 possibilities.
1/ Either upgrade the zlib version. Do not know if there is an experimental repository for ubuntu. Be aware that could lead to some breakage in your distribution.
2/ Or recompile pcsx2. In this situation, I am not sure, pcsx2 team will still support your version. To be complete, it will probably need some patches to be sure it is taken your zlib distribution version. Do not know if is working, but you could try to remove the following line (it will remove post 1.2.3.4 feature).
Code:
./pcsx2/gui/SysState.cpp:84:        #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1240)
./pcsx2/gui/SysState.cpp-85-            gzbuffer(m_gzfp, 0x100000); // 1mb buffer for zlib internal operations
./pcsx2/gui/SysState.cpp-86-        #endif
--
./pcsx2/ZipTools/thread_gzip.cpp:81:#if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1240)
./pcsx2/ZipTools/thread_gzip.cpp-82-    gzbuffer(m_gzfp, 0x100000); // 1mb buffer size for less file fragments (Windows/NTFS)
./pcsx2/ZipTools/thread_gzip.cpp-83-#endif
Arcum,

There was some renaming in the middle of my previous patches by Air. SetLogFolder was renamed setLogDir (to follow setSetttingsDir I think) but not everywhere. Actually it is a real mess Smile At least the callback name must be rename in the main side. (maybe also the callback for consistency)
./pcsx2/PluginManager.cpp:295: { "SetLogFolder", (vMeth*)fallback_SetLogFolder },

Moreover you use the pad callback (PADSetLogFolder which must be renamed PADsetLogDir) in USBnull, FWnull, dev9null.

Enjoy.

Edit: I attached a quick patch to fix the stuff.

Edit: there is another issue. line 235 of ./pcsx2/gui/AppCorePlugins.cpp It use the settings dir instead of the log one. Warning it is not fix in the attached patch
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35