RA Design and Discussion
Posted: 09 Jan, 2017 02:49
Wow, that sounds really great though, but that sure was a ton of work that went into it. XD Well good luck with the integration if it goes through then, will be very interesting to see where it goes from there.
Posted: 09 Jan, 2017 05:11
Last Edit: 09 Jan, 2017 05:15
Well I'd say the next order of business is to make a custom lib of libpng, zlib is already taken care of. libpng on NuGet only supports v120 and v140 toolset but both projects are set to use the v140_xp toolset.
There are a shitload of warnings in the older version of Snes9x but not the new one, I don't feel like fixing them so I'm turning them off.
3rd party libs/APIs should never be altered, that's why I'm using NuGet. W/ RA_Integration alone, there are no dependency projects or submodules (so much pain). It makes life easier. Unless it's a .net project there is no need to organize separate projects for the same purpose.
Posted: 10 Jan, 2017 00:18
Last Edit: 10 Jan, 2017 00:36
Ok ran into a giant snag and it has to do with RA_Interface. I never touched that area because it's purpose seemed ambiguous but I guess the "exports" are for the emus.
It might take me awhile to figure out what's wrong unless someone knows it well.
From what I've noticed so far it's a bunch of bad coding practices. I think I'll need to remove some includes from Snes9x and use conditional macros to make friend classes in RA_Integration. Snes9x 1.54.1 did a complete refactor and doesn't have these issues but I need to test with current versions.
There are also undefined/undeclared functions in RA_Interface (how in god's name did this compile before)?
Posted: 10 Jan, 2017 00:58
Last Edit: 10 Jan, 2017 01:33
There's two solution I think may work, one is more drastic but too bad.
The first one is to make all the "externs" static, redefinition is killing me. Extern is normally when your calling a function outside the scope of the project such as from a dll/lib. It makes absolutely no sense to call something extern in the same project unless you aren't using classes.
The second idea is to make it a class library with C linkage, it seems like it would solve a lot of things but I'll try that later.
Edit: I'm used to Object Oriented Programming, it'll be easier for me to just make it a class library as a C interface.
Posted: 10 Jan, 2017 05:43
OK, I "think" I might be getting somewhere.
I went ahead and made RA_Interface into a class, there's a few linker errors now with libpng and xaudio2. Some static functions defined in RA_Integration have unresolved externals as well.
Well I have class starting tomorrow so I might not have much time to work on this.
Posted: 10 Jan, 2017 23:16
Last Edit: 10 Jan, 2017 23:32
I'm having a really tough time working with globals so another "rehaul" will be required. What I'm saying is that everything in RA_Integration will be under the namespace "RA". The split files will have a namespace of the original filename filenames without RA. For example ComparisonType, ComparisonVariableSize, ComparisonVariableType, CompVariable, Condition, ConditionSet, and ConditionType will be under the namespace "RA::_Condition". Sub namespace names will be shortened if too long and be aliased where needed. This will allow us to use usings like C#.
RA_Core and RA_Implementation will now be classes as well with C linkage. Any class that does not have complex STL containers like vector, stack, queue, list, etc will not have C linkage as C does not support templates. All structs have been converted to classes as well.
This will make pointer to members and function calls from other classes a lot more efficient with less hassle. I've been sick and tired (not mad at anyone) with errors saying redeclared/redefined and all that garbage. Object-Oriented style is truly the best from a Software Engineering and Design standpoint. You can still export functions as C from C++ classes so the project will not break.
I'm still worried about RA_Keys.dll. If I can't figure it out I'll post an issue on the official repo.
I'm taking advantage of the friendship concept to ensure only specific classes can use protected/private members from another class. There were TONS of cases where memory leaks could happen that were obvious so that's why I made this decision. This makes it possible for most of the stuff I wanted to do early with relative ease.
I'm just doing this in my free time since it helps me out from a learning standpoint. Just posting updates when I believe it's important or just for reference.
@Scott (if you read this)
There were some parts of the code I didn't quite understand. In RA_Core there's a code block that goes like this:
#define API __cdeclspec(dllexports)
I've never really worked with drivers or whatever you use that for but I added another part but I'm not sure if I'm supposed to. Following Microsoft's example I made it like this.
#define API __cdeclspec(dllexports)
#define API __cdeclspec(dllimports)
I think the above makes more sense because RA_EXPORTS is not defined in "RASnes9x". Like RA_Integration is the exporter and Snes9x is the importer. I'd really appreciate some input if possible.
Posted: 13 Jan, 2017 03:23
Last Edit: 13 Jan, 2017 20:54
Edit: The below will apply if my proposed solutions don't work, this edit will be removed if that's the case. (see the second post for more details)
I'm just gonna tell you guys I'm gonna take a long ass break from this. The biggest problem now are to function pointers and will need to be rehauled (again...). RA_Integration still builds by itself but I'm have some trouble integrating it. I don't have time because of school.
If anyone is interested or just wants to read the below.
Main areas that need work (I'm not gonna push my recent changes because it won't build)
The function I'm having trouble with is InstallSharedFuncs (or something like that), I never using function pointers personally so it would take me too long (not that I would mind if I could spare the time)
I'm guessing RA_Implementation needs to stay global and not be wrapped in any namespaces or classes (because the namespace mangling probably messed it up so everything else can stay as a class with namespaces except RA_Implemenation).
I can just Merge changes later. Good luck to you all.
Posted: 16 Jan, 2017 06:09
Well std::function seems work exactly like a function pointer. It stores functions, binds calls, etc. The best thing is that you don't need to repeat the calling convention (__cdecl) inside it. It seems it has to be initialized to store a function or it will be considered redefined.
I think I'm getting somewhere, RA_Interface is gonna have the function pointers replaced. It also helps me find erroneous function pointers (like having int instead of void).
login to retroachievements.org:
or create a new account
or create a new account