SameBoy | Game Boy and Game Boy Color emulator written in C | Game Engine library
kandi X-RAY | SameBoy Summary
kandi X-RAY | SameBoy Summary
SameBoy is an open source Game Boy (DMG) and Game Boy Color (CGB) emulator, written in portable C. It has a native Cocoa frontend for macOS, an SDL frontend for other operating systems, and a libretro core. It also includes a text-based debugger with an expression evaluator. Visit the website.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SameBoy
SameBoy Key Features
SameBoy Examples and Code Snippets
Community Discussions
Trending Discussions on SameBoy
QUESTION
I came across an odd set of macros in the SameBoy emulator (v0.13) that seems to use an empty struct to address data. It looks like this:
...ANSWER
Answered 2020-Jun-04 at 03:36Empty structs are not allowed by standard C, but are an extension provided by gcc. They are exactly what they seem, an object of size 0, and they do exactly what you expect, which is essentially nothing. They have no members to be accessed. You can assign one to another, but it's a no-op. They're most useful as placeholders, as in this case.
__attribute__((aligned (8)))
does the same thing it usually does: guarantees that an object with this attribute is aligned on an 8-byte boundary. In other words, its address will be a multiple of 8.
In this program, the macros are used to divide the members of a large struct into "sections", each of which begins on an 8-byte boundary, and to create zero-byte empty struct members to mark the beginning and end of each section. The code looks something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SameBoy
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page