Final Platform Layer»Blog

Big Release v0.9.0.0

Hi all,

i have another release for you all ;-)

This time its a huge release! I changed and improved FPL a lot and added a ton of new functionality to it. Here are the main changes:

64-bit File-IO:

There are now file methods for working with 64-bit files, such as fplReadFileBlock64, fplWriteFileBlock64, etc. I also added general size_t file functions which maps to the 32 or the 64 version - depending on the compiled platform.

Gamepad Support on Linux:

Gamepad support for linux is now implemented as well - tested with a Logitech F310 Gamepad successfully. But its limited to /dev/input/js0 for now. I will add more device node detections later on, i am pretty sure there are kernels which have different device names for joysticks.

Locales:

There are now functions for getting the keyboard/user/system locales, which i needed for a new demo.

Improved input:

OEM keys are now properly mapped - hopefully correct. Modifier keys are now separated by left/right. And i fixed the detection of new key states, which was broken when fplMappedKey does not match the keycode. Oh and i broke the mouse movement event on X11, which is now fixed ;) And lastly i added polling support for getting on demand full keyboard/gamepad states, so you are not forced to rely on the event-system for input events anymore - but you can if you want to. Mouse polling will come in the next version, i simply forgot it -.-

X11 changes:

Icons should now be properly loaded in the same way it works on Win32, if not i messed up a commit - because it was already working on XFCE and KDE but on Unity it does not work at all. Edit: Of course i broke the icon code in this version, but i already fixed it in the develop branch, yay.

New/Improved demos:

The FPL_ImageViewer is now finished and works beutifully. The only thing left in there is to add downsampling/mipmapping, so you can see tiny little details on every size.

I added a new demo called FPL_Input which is very useful to test out and visualize all the input stuff. At the moment it displays a full keyboard with mapped keys to de-DE or en-US.

There are tons of improvement on the game framework i build for the game demos, like for example the controller detection and handling now works properly - thanks to @mrmixer for that ;)

State / Future-Plans:

I changed the version to 0.9 because the project is almost complete now. My next plan is to actually finish FPL by implementing all the @IMPLEMENT tasks and the major todos, like for example network UDP/TCP support. Then i will focus on finishing the documentation - which will take a huge amount of time because i suck at writing :-(

After that i will start a extensive beta-testing program and will mostly focus on bugfixing.

Thats it for now, you can get more details about all changes in the full changelog below. As usual the documentations are updated and version is tagged.

Until next time! Changelog:
 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
## v0.9.0.0 beta:
- Changed: fplKey_Enter renamed to fplKey_Return
- Changed: fplKey_LeftWin renamed to fplKey_LeftSuper
- Changed: fplKey_RightWin renamed to fplKey_RightSuper
- Changed: fplKey_Plus renamed to fplKey_OemPlus
- Changed: fplKey_Minus renamed to fplKey_OemMinus
- Changed: fplKey_Comma renamed to fplKey_OemComma
- Changed: fplKey_Period renamed to fplKey_OemPeriod
- Changed: fplKeyboardModifierFlags_Alt are split into left/right part respectively
- Changed: fplKeyboardModifierFlags_Shift are split into left/right part respectively
- Changed: fplKeyboardModifierFlags_Super are split into left/right part respectively
- Changed: fplKeyboardModifierFlags_Ctrl are split into left/right part respectively
- Changed: All bool fields in structs are replaced with fpl_b32
- Changed: Added COUNTER macro to non-CRT FPL_STATICASSERT
- Changed: Renamed fields in fplMemoryInfos to match correct meaning
- Changed: String copy functions uses fplMemoryCopy instead of iterating and copy each char
- Changed: fplSetFilePosition32 returns now uint32_t instead of void
- Changed: Added field timeStamps to fplFileEntry
- Changed: [X11] Window title uses XChangeProperty now instead of XStoreName
- Changed: [Win32] Detection of left/right keyboard modifier flags
- Changed: [Win32] Mapping OEM 1-8 keys
- Changed: [Win32] Use MapVirtualKeyA to map key code to virtual key
- Fixed: Corrected a ton of comments
- Fixed: fpl__HandleKeyboardButtonEvent had incorrect previous state mapping
- Fixed: [X11] fplMouseEventType_Move event was never created anymore
- New: Added typedef fpl_b32 (32-bit boolean type)
- New: Added struct fplKeyboardState
- New: Added struct fplGamepadStates
- New: Added function fplGetKeyboardState()
- New: Added function fplGetSystemLocale()
- New: Added function fplGetUserLocale()
- New: Added function fplGetInputLocale()
- New: Added function fplGetGamepadStates()
- New: Added function fplKey_Oem1-fplKey_Oem8
- New: Added function fplGetFileTimestampsFromPath
- New: Added function fplGetFileTimestampsFromHandle
- New: Added internal function fpl__ParseTextFile used for parsing /proc/cpuinfo or other device files
- New: Added function fplGetFileSizeFromHandle
- New: Added function fplGetFileSizeFromHandle64
- New: Added function fplGetFileSizeFromPath
- New: Added function fplGetFileSizeFromPath64
- New: Added function fplGetFilePosition
- New: Added function fplGetFilePosition64
- New: Added function fplSetFilePosition
- New: Added function fplSetFilePosition64
- New: Added function fplWriteFileBlock
- New: Added function fplWriteFileBlock64
- New: Added function fplReadFileBlock
- New: Added function fplReadFileBlock64
- New: [Win32] Implemented fplGetKeyboardState
- New: [Win32] Implemented fplGetGamepadStates
- New: [Win32] Implemented fplGetSystemLocale
- New: [Win32] Implemented fplGetUserLocale
- New: [Win32] Implemented fplGetInputLocale
- New: [Win32] Implemented fplGetFileTimestampsFromPath
- New: [Win32] Implemented fplGetFileTimestampsFromHandle
- New: [Win32] Implemented fplReadFileBlock64
- New: [Win32] Implemented fplWriteFileBlock64
- New: [Win32] Implemented fplSetFilePosition64
- New: [Win32] Implemented fplGetFilePosition64
- New: [Win32] Implemented fplGetFileSizeFromPath64
- New: [Win32] Implemented fplGetFileSizeFromHandle64
- New: [X11] Implemented fplGetKeyboardState
- New: [X11] Set window icon title using XChangeProperty
- New: [X11] Give window our process id
- New: [X11] Load window icons on startup
- New: [X11] Added ping support for letting the WM wakeup the window
- New: [Linux] Implemented fplGetSystemLocale
- New: [Linux] Implemented fplGetUserLocale
- New: [Linux] Implemented fplGetInputLocale
- New: [Linux] Reading first joystick as game controller in linux
- New: [POSIX] Implemented fplGetFileTimestampsFromPath
- New: [POSIX] Implemented fplGetFileTimestampsFromHandle
- New: [POSIX] Implemented fplReadFileBlock64
- New: [POSIX] Implemented fplWriteFileBlock64
- New: [POSIX] Implemented fplSetFilePosition64
- New: [POSIX] Implemented fplGetFilePosition64
- New: [POSIX] Implemented fplGetFileSizeFromPath64
- New: [POSIX] Implemented fplGetFileSizeFromHandle64
Mārtiņš Možeiko, Edited by Mārtiņš Možeiko on

Your fplReadFileBlock64 function is wrong on 32-bit Linux. It will cast uint64_t to size_t which is 32-bit long and the result will be wrong. Let's say you ask it to read 0x100000001 bytes. On 32-bit Linux this should fail because virtual address space is not so large. But your code will read 1 byte and succeed.

Same with write function.
Edited by Finalspace on
mmozeiko

Your fplReadFileBlock64 function is wrong on 32-bit Linux. It will cast uint64_t to size_t which is 32-bit long and the result will be wrong. Let's say you ask it to read 0x100000001 bytes. On 32-bit Linux this should fail because virtual address space is not so large. But your code will read 1 byte and succeed.

Same with write function.


You are correct sir, no idea why i didnt done it in the same way i do on win32, which is to break up the uint64_t into uint32_t chunks.

Damn it.

*Edit: I fixed it in the develop branch.