Would you prefer to work with global variables or would you rather pass the variables as function parameters? I found global variables to be rather helpful when I was programming, but I'd leave the decision up to you.
I'd be willing to volunteer myself for step 3: reading of the game list and other XML files.
Should we read all XML files for all systems at start up (also so we can check which systems/games are available) or should we load them whenever a user selects them (and perhaps then find out there's nothing in there)?
On a more basic level: do we wish to use (double) linked lists, vector or deque for our lists?
Btw, when it comes to classes: what are your views on public fields vs private fields with public functions? I've noticed in the past that the second option left me with a lot of code that really wasn't very helpful (mostly a lot of set and get functions to use in stead of direct field assignment using the "." separator. I understand the principle behind using private fields, but I haven't found much advantage to it in front-end development yet.
Both answers in one! (in the name of efficiency, or laziness since I broke my left hand on monday...) I've added some explanation for those that lean toward C.
more info at www.cplusplus.com
On Wed, 8 Oct 2014 05:36:28 -0700 (PDT), Pieter Hulshoff wrote
>
Btw, when it comes to classes: what are your views on public fields vs private
fields with public functions? I've noticed in the past that the second option
left me with a lot of code that really wasn't very helpful (mostly a lot of set
and get functions to use in stead of direct field assignment using the "."
separator. I understand the principle behind using private fields, but I haven't
found much advantage to it in front-end development yet.
>
First, in C++ the only difference between structs and classes is that structs by default have publicly accessible variables. Classes, by default, are private. In practice, structs are used as data containers, classes are used for encapsulation and built-in functions. I would use a struct for a 2D Point for ease of pt.x and pt.y. I would use a class for a vector, to overload functions like Multiply, Add, Subtract, etc...
The way I was taught was to think about Get/Set vs. public access is to think more about 'who' really needs access and whether you want input validation. While you could make some screen layout widget a struct and give direct access to coordinates, having a "set" function will allow you to ensure the value is within bounds, or truncate/handle accordingly.
Basically, its an API approach along the lines of forcing the class to handle itself (encapsulation). If I am the control class and you are the UI, I should tell you the user pressed the down arrow, not muck around in your internal variables. For small programs this is pretty immaterial. However, looking forward we may have SteveAndPietersSuperFancyXMLClass, which we pull out into a library that can be reused by other projects.
> From what I could find, vectors will reduce cache misses during linear search since all memory is allocated contigously, and we generally search down through the list.Once lists are created, we generally don't need to inject or delete objects very often, which reduces the advantages of deque over vector. In all honesty: I haven't used either that much, since I've had more experience programming in C than in C++, but I think we can use them to our advantage. Joseph, care to give us your 2 cents?
>
Now we are getting into the low-level stuff. A vector is more or less an array with some extra sugar. Yes, primary storage is contiguous, but can be set to a specific size. By default, vector will allocate an array of size "N" (i'm sure its somewhere in vector.h). Once the needed storage gets larger than "N", a vector will allocate a larger block and, as of C++11 if memory serves, move stuff over (or copy if necessary). Reading/writing are cheap,,, but insertions/deletions are expensive since to insert between to existing things (or remove a chunk) may force a new copy to happen. Is being able to say "Item[7]" really more valuable than clearing/repopulating the vector for some subset of the overall list?
Lists are not contiguous, and have the overhead of pointers at each "node". Doubly linked lists have two pointers and allow for bidirectional search. However, searching for entry "X" is expensive because you have to start at the head pointer and count. Finding a subset to display can be done, but it might be a little slow and computationally expensive. Iterators improve this a bit... We can keep "currentSelection" and go forward/back a few as needed.
A queue/deque is a first-in-first-out (FIFO) container. Best used when you only care to visit something oncem then throw it away. Think about entering grades into a gradebook. You have a stack of papers from one student. You "dequeue" or "pop" the top, process it, then toss it aside (free or delete). A dequeue does that from both sides.
For our purposes the most important thing is to eliminate redundancy and maintain usability. I think a combination would probably be the best. I would use a deque or circular linked list for pulling/displaying games/systems. I would use an array or vector to grab a set size then could loop and push_front, or push_back to populate the deque... while "pop"ing from the opposite side. We also maintain an iterator at the "middle" which would be the current selection. Then all that remains is finding a way to say "give me the previous 50" on the list, which may circle from a to z.
Clear as mud?
-Joseph
I've started my XML experiments by writing a game file parser (fileio.cpp; do we want to use .cpp or .c for our file extensions?) using xmllib2.
Using xmllib++ proved too much hassle, so I'll just convert to std::string whenever I need to, and use C++ wherever appropriate. I'll need classes for games and game lists though; who will be writing those? I could write something for now that can be either temporary until replaced or updated/reused later; it's up to you.
I'll use this experiment to see if xmllib works fast enough to use for this purpose or if I have to rewrite the functions using something less validating. :)
On 9 October 2014 16:53, Pieter Hulshoff <phuls...@gmail.com> wrote:
I've started my XML experiments by writing a game file parser (fileio.cpp; do we want to use .cpp or .c for our file extensions?) using xmllib2.
Cool. Definitely .cpp extension and .hpp for headers. You never know when we might need to mix in a bit of straight C. While we're at it: quick show of hands on naming conventions? I'm used to using CamelCase for class names in C++ and naming the files in the same way.
Using xmllib++ proved too much hassle, so I'll just convert to std::string whenever I need to, and use C++ wherever appropriate. I'll need classes for games and game lists though; who will be writing those? I could write something for now that can be either temporary until replaced or updated/reused later; it's up to you.
Feel free to write any classes you need to get going. Also, the sooner we can start integrating things the better. If you're able to work on a branch of the GitHub repo, that's ideal as it makes merging a lot easier down the line.
Nice. I also came across this, no idea if it fits the bill: http://vtd-xml.sourceforge.netI'll use this experiment to see if xmllib works fast enough to use for this purpose or if I have to rewrite the functions using something less validating. :)
On 10/9/2014 9:06 AM, Steve Maddison wrote:
C++ classnames: CamelCaseCool. Definitely .cpp extension and .hpp for headers. You never know when we might need to mix in a bit of straight C. While we're at it: quick show of hands on naming conventions? I'm used to using CamelCase for class names in C++ and naming the files in the same way.
member variables: <type>_lowerThenCamel (e.g. i_myInteger, p_myPointer)
functions: CamelCase
.cpp and .hpp definitely. Some compilers get confused based on file extensions (Visual C++ treats .c as C, gcc will do the same. cpp will trigger C++ compiles)
--
You received this message because you are subscribed to the Google Groups "Cabrio FE Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cabrio-fe-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Just a thought:On 10/9/2014 9:56 AM, Steve Maddison wrote:
I'll see if I can find some suitable and well-documented style guide online which we can refer to - open to suggestions though if anyone knows of a good one. Everyone will hate something about any chosen convention, so that kind of makes it fair in the end ;-)
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html
http://smacked.org/docs/cpp_style_google.pdf
...different than I'm used to, but well codified.
I would like to take a decision with regards to our game list class structure. Assuming the new game list structure, how do we connect them to our system list, and how do we store the game list for each system?
I think my suggestion was misunderstood. Particularly with a large list, we want to minimize redundancy. That means as few duplicates as possible. I was imagining we keep an xml reference structure for the "full" list. We use the deque ONLY for what is shown on screen, possibly with a half screen slack on either side. If we are using a wheel that has 10 items on screen, the deque will have 20 items, with a "currentSelection" iterator. It sounds reasonable in my head since we will have a small list to go through for redraws. How that links to execution is still a little fuzzy (maybe the deque type is XMLNode*). There should be a DisplayIFace that interfaces with OpenGL/DX/whatever... then a GUIClass that owns the deque, and sends updates to DisplayIFace (say).
With regards to the system<->game linkage, HS implicitly links based on the list the game resides in. e.g., if "sonic & knuckles" is in "genesis.xml" it will use the emulator defined for "genesis" in the "system.xml". It also allows explicit links via an optional tag in the game entry (I think "executable"). The execution is done via an executable script made in AutoHotKey, that looks a little like this:
Some systems support multiple media formats (cartridge, disk, cassette, cdrom); I haven't quite figured out how best to handle those. The consoles don't have that problem, so that part should be relatively easy. I'll write up some class files soon, and update the file I/O accordingly. System information will probably be put in a systems.xml file as Joseph mentioned. I'll start out with a small set of systems to see how that works; not all systems are interesting to be added anyway, and for many of those systems we don't have any art available either.
Any thoughts?
Perhaps I should have been slightly more clear: I know how to do it by hand, but I have to figure out how to detect this automatically so I can autogenerate the corresponding XML files rather than writing them by hand. :)
Perhaps I should have been slightly more clear: I know how to do it by hand, but I have to figure out how to detect this automatically so I can autogenerate the corresponding XML files rather than writing them by hand. :)
With a menu I mean the selection hierarchy to come to a game selection. How those games are connected in the end is up for debate:
1. Like in HS and Cabrio 1.0, games are a part of the menu via XML files.
2. Games are in a database, and each endmenu can make a specific selection. This however does mean that for each list selection criteria must be found.
3. Both: standard menu structure with games, but games are also stored in a database to allow automatic list generation based on criteria, e.g. all racing games starting with "ro".
--
You received this message because you are subscribed to the Google Groups "Cabrio FE Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cabrio-fe-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hoped to get back to you earlier than this but have been stuck with a tiny screen every time I got a chance to look at it! I'm having a bit of a hard time "getting it" out of context - do you have some code which uses this class? Does this structure contain the actual game data?
Word is back from the HS community: no torrents with their material. I guess we'll just point to their repositories in stead, and encourage people to become a member there.
For now I only have a few minor changes in mind left for the menu structure (unless you two have some specific changes in mind other than a proper C++ overhaul by Joseph), so I'll focus on writing some more tools for XML generation, theme installation, and file renaming. We'll need those to provide a smooth user experience. Besides: I'd hate to have to do this manually more than once. :)
On Wednesday, October 22, 2014 9:49:14 PM UTC+2, Steve Maddison wrote:Hoped to get back to you earlier than this but have been stuck with a tiny screen every time I got a chance to look at it! I'm having a bit of a hard time "getting it" out of context - do you have some code which uses this class? Does this structure contain the actual game data?
Yes, I do. I checked the menu code into the database, but I'm also sitting on a small test program, which reads the menu, and then prints part of that information to the screen (or a file if you pipe it there).
I also have a menu.xml file, and xml game files for 7 MESS systems and for MAME. I'm not sure what to do with those files: check them into the database separately, as a tgz file or simply email them to you to play around with.
Joseph, are you in the process of improving the C++ capacity of my code, or can I safely make changes in the next few weeks?
Having seen what's available on the HS FTP server, I can imagine people having trouble getting a full system up and running. Without HyperSync, that's really a tough job to do! I think I'm just going to go define a directory structure that'll work for me, and we can take the discussion from there on whether or not we want everything programmable or just use a fixed structure, and (auto)convert the files.
Be well Joseph, hope you'll feel better soon.
With regards to directories: do we wish to use a fixed directory structure, a fixed directory structure with an offset for each emulator or a completely configurable directory structure? Should ROMs be a part of this directory structure or should they be separately configurable from the media files? As an example:
Often seen structures:
Media/<system>/<media files>
PD repositories for MESS however:
<media type>/<system>
We should either choose a structure that we feel is handy, and perhaps provide some tools to convert repositories to that format, or we need to set up configurable paths for every media type. Any thoughts?
With regards to the menu structure: I'm considering separating the emulator settings from the rest of the menu. That way, if the same emulator is used in different menus, the paths etc. only need to be defined once.
Do we wish to add zip support within Cabrio 2.0 with regards to theme and art packaging?
With regards to emulators: I've been focusing on MAME and MESS so far, but are there any others we should consider adding? I know it will be configurable, but I'd like to test things well to make sure we're not missing something. MAME/MESS for instance don't need specific rom file names anymore; it will automatically find them within the .zip or .7z packages available through the usual channels.
Having seen what's available on the HS FTP server, I can imagine people having trouble getting a full system up and running. Without HyperSync, that's really a tough job to do! I think I'm just going to go define a directory structure that'll work for me, and we can take the discussion from there on whether or not we want everything programmable or just use a fixed structure, and (auto)convert the files.
I'm still mostly in my own sandbox anyway, I don't think my code had been pulled yet.
As a side note, occasionally you'll run into a zip of multiple games. .. such as a single zip that has different versions of the same game. An emulator won't understand that, I'm not so sure we should either.
Mame has a user configurable rom search path. I think we may want to do the same to allow for user configurability. It's set like an ENV list, a semicolon delimited lost of fully qualified paths. I like that idea, even though it's a little added complexity.
Personally, I use:
Snes9x
Nestopia
Yabouse
Mupen64
Gens
Epsxe
Dolphin
All of the above will execute a fully qualified path to a rom. The only question is if we want separate search paths by system, or one full-up list.
I tried sending a pull request, but my build environment wasn't allowing it. Feel free to pull my code in.
I'm thinking do it the same as the media; allow paths to be specified globally and at all levels down to the individual game. Then just search through the paths heirarchically from specific to general and stop when you find something. With any luck we can even reuse the same code. I hadn't thought of specifying multiple paths at each level though, which we'll no doubt need to allow.
Steve,
Thanks for taking care of that part. I've been mulling over how to do an abstraction over such a beast, a sort of intermediate layer that handles a generic outline mode (list, grid, etc. ..) between system calls and the user interface.
My thinking is this layer can be an abstract class in itself, then we can derive stuff from it. Should make it relatively simple to introduce new display formats. I'm planning on tearing into that tonight.
On 28 October 2014 23:46, Joseph K <jcko...@cs.unm.edu> wrote:
Steve,
Thanks for taking care of that part. I've been mulling over how to do an abstraction over such a beast, a sort of intermediate layer that handles a generic outline mode (list, grid, etc. ..) between system calls and the user interface.
I figured being able to place quads however you like in 3D space allows us to do pretty much anything we envisioned up to now. And anything else can be added later.
My thinking is this layer can be an abstract class in itself, then we can derive stuff from it. Should make it relatively simple to introduce new display formats. I'm planning on tearing into that tonight.
Totally with you there. This is essentially the "hard" (as in compile-time) part of something approaching upon a theme. Maybe it actually is a theme and the imagery, colours, etc. are more of a skin. Or maybe a "theme" is a combination of this thing and a skin. It'll be an important class; how were you thinking of naming it?
I suppose what we then need is an equivalent of the Renderer class for event handling, which can then be implemented in different ways (SDL, GLFW, whatever) and manages an (abstract) event queue that can be popped by the above.