Note-to-self, Research, Game programming (mainly c++ sdl), Programming, Application development, Resource, Computer tech, Hex'n'hax ++
Thursday, 27 August 2015
Tuesday, 25 August 2015
Monday, 24 August 2015
Saturday, 22 August 2015
Stretching Your Game To Fit The Screen Without Letterboxing - SDL2
http://www.gamedev.net/page/resources/_/technical/apis-and-tools/stretching-your-game-to-fit-the-screen-without-letterboxing-sdl2-r3547
...BUT, to get letterboxing and/or keep aspect ratio, use the SDL flag:
...BUT, to get letterboxing and/or keep aspect ratio, use the SDL flag:
SDL_WINDOW_FULLSCREEN_DESKTOP
this way the graphic is not stretched.Friday, 21 August 2015
Monday, 17 August 2015
Books
Beginning Game Programming Paperback – Jul 19 2004 by Michael Morrison (Author)
http://www.amazon.ca/Beginning-Game-Programming-Michael-Morrison/dp/0672326590
Game Coding Complete, Fourth Edition Paperback – March 5, 2012 by Mike McShaffry
http://www.amazon.com/Game-Coding-Complete-Fourth-Edition/dp/1133776574
SDL Game Development - Paperback – 24 Jun 2013 by Shaun Mitchell (Author)
http://www.amazon.co.uk/Sdl-Game-Development-Shaun-Mitchell/dp/1849696829
Reddit forum q&a
https://www.reddit.com/r/learnprogramming/comments/21ercr/what_is_the_best_c_book_out_there_for_learning/
http://www.amazon.ca/Beginning-Game-Programming-Michael-Morrison/dp/0672326590
Game Coding Complete, Fourth Edition Paperback – March 5, 2012 by Mike McShaffry
http://www.amazon.com/Game-Coding-Complete-Fourth-Edition/dp/1133776574
SDL Game Development - Paperback – 24 Jun 2013 by Shaun Mitchell (Author)
http://www.amazon.co.uk/Sdl-Game-Development-Shaun-Mitchell/dp/1849696829
Reddit forum q&a
https://www.reddit.com/r/learnprogramming/comments/21ercr/what_is_the_best_c_book_out_there_for_learning/
GameTutorials / Collision detection
https://www.gametutorials.com/
2D Platform Games Part 1: Collision Detection for Dummies
https://katyscode.wordpress.com/2013/01/18/2d-platform-games-collision-detection-for-dummies/
Managing collision detection in games
http://stackoverflow.com/questions/4311034/managing-collision-detection-in-games
2D Platform Games Part 1: Collision Detection for Dummies
https://katyscode.wordpress.com/2013/01/18/2d-platform-games-collision-detection-for-dummies/
Managing collision detection in games
http://stackoverflow.com/questions/4311034/managing-collision-detection-in-games
Sunday, 16 August 2015
Mangling win32 executables with a hex editor
Original text by Eli Billauer
http://billauer.co.il/blog/2010/07/hex-editor-exe-win32-dll-ocx/
This is a short note about how to make small manipulations in executables or DLLs in order to get rid of malware behaviour. For example, if some application pops up a dialog box which I’d like to eliminate. It can also be the final step in cracking (which is very recommended as an educational experience).
Keep in mind that getting something useful done with this technique requires a very good understanding of assembly language, and how high-level languages are translated into machine code.
The general idea is to hook up a debugger (Microsoft Visual Studio’s will do, using Tools > Debug Processes), and try to get a breakpoint exactly where the bad things happens. Then, after verifying that there is a clear relation between the certain point in the code to the undesired behavior, use the debugger to skip it a few times, in order to be sure that it’s the fix. Tracing the API calls can be very helpful in finding the crucial point, as I’ve explained in another post. But if the offending behavior involves some message box (even if the popup only announces the issue), odds are that the critical point can be found by looking at the call stack, when attaching the debugger to the process, with the popup still open. Look for where the caller is the application itself (or the related DLL/OCX).
Lastly, the code must be changed in the original file. Fortunately, this can be done with a hex editor, since no CRC check is performed on executables.
One thing to bear in mind is that the code is possibly relocated when loaded into memory. During this relocation, absolute addresses in the machine code are mangled to point at the right place. This is why any opcode, which contains an address can’t be just changed to NOPs: The linker will do bad things there.
A crucial step is to match the memory viewed in the debugger with a position in the file. First we need to know where the EXE, DLL or OCX are mapped in memory. The Dumper application from the WinAPIOverride32 suite gives the mapped addresses for each component of a process, for example. The file is typically mapped linearly into memory, with the first byte going to the first address in memory. An application such as the PE Viewer (sources can be downloaded from here) can be helpful in getting a closer look on the Portable Executable data structure, but this is usually not necessary.
Once the hex data in the file matches what we see in the debugger, we’re left with pinpointing the position in the hex editor, and make the little change. There are a few classic simple tricks for manipulating machine code:
Put a RET opcode in the beginning of the subroutine which does the bad thing. RET’s opcode is 0xC3. Eliminating the call itself is problematic, since the linker may fiddle with the addresses.
Put NOPs where some offending operation takes place. NOP’s opcode is 0x90. Override only code which contains no absolute adresses.
Insert JMPs (opcode 0xEB). This is cool in particular when there is some kind of JNE or JEQ branching between desired and undesired behavior. Or just to skip some piece of code. This is a two-byte instruction, in which the second byte is a signed offset for how far to jump. Offset zero means NOP (go to the next instruction).
When the mangling is done, I suggest opening the application with the debugger again, and see that the disassembly makes sense, and that the change is correct. Retaining the break point once is good to catch the critical event again, and see that the program flows correctly from there on.
http://billauer.co.il/blog/2010/07/hex-editor-exe-win32-dll-ocx/
This is a short note about how to make small manipulations in executables or DLLs in order to get rid of malware behaviour. For example, if some application pops up a dialog box which I’d like to eliminate. It can also be the final step in cracking (which is very recommended as an educational experience).
Keep in mind that getting something useful done with this technique requires a very good understanding of assembly language, and how high-level languages are translated into machine code.
The general idea is to hook up a debugger (Microsoft Visual Studio’s will do, using Tools > Debug Processes), and try to get a breakpoint exactly where the bad things happens. Then, after verifying that there is a clear relation between the certain point in the code to the undesired behavior, use the debugger to skip it a few times, in order to be sure that it’s the fix. Tracing the API calls can be very helpful in finding the crucial point, as I’ve explained in another post. But if the offending behavior involves some message box (even if the popup only announces the issue), odds are that the critical point can be found by looking at the call stack, when attaching the debugger to the process, with the popup still open. Look for where the caller is the application itself (or the related DLL/OCX).
Lastly, the code must be changed in the original file. Fortunately, this can be done with a hex editor, since no CRC check is performed on executables.
One thing to bear in mind is that the code is possibly relocated when loaded into memory. During this relocation, absolute addresses in the machine code are mangled to point at the right place. This is why any opcode, which contains an address can’t be just changed to NOPs: The linker will do bad things there.
A crucial step is to match the memory viewed in the debugger with a position in the file. First we need to know where the EXE, DLL or OCX are mapped in memory. The Dumper application from the WinAPIOverride32 suite gives the mapped addresses for each component of a process, for example. The file is typically mapped linearly into memory, with the first byte going to the first address in memory. An application such as the PE Viewer (sources can be downloaded from here) can be helpful in getting a closer look on the Portable Executable data structure, but this is usually not necessary.
Once the hex data in the file matches what we see in the debugger, we’re left with pinpointing the position in the hex editor, and make the little change. There are a few classic simple tricks for manipulating machine code:
Put a RET opcode in the beginning of the subroutine which does the bad thing. RET’s opcode is 0xC3. Eliminating the call itself is problematic, since the linker may fiddle with the addresses.
Put NOPs where some offending operation takes place. NOP’s opcode is 0x90. Override only code which contains no absolute adresses.
Insert JMPs (opcode 0xEB). This is cool in particular when there is some kind of JNE or JEQ branching between desired and undesired behavior. Or just to skip some piece of code. This is a two-byte instruction, in which the second byte is a signed offset for how far to jump. Offset zero means NOP (go to the next instruction).
When the mangling is done, I suggest opening the application with the debugger again, and see that the disassembly makes sense, and that the change is correct. Retaining the break point once is good to catch the critical event again, and see that the program flows correctly from there on.
C# Tutorial: Dot Net Perls
http://www.dotnetperls.com/
This tutorial focuses on the C# programming language.
It provides complete example C# programs.
This tutorial focuses on the C# programming language.
It provides complete example C# programs.
Game programming ( SDL, C++, SFML, C# )
Simple DirectMedia Layer (SDL)
https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
SDL Tutorials
http://www.sdltutorials.com/
Getting Started With SDL
https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
SDL Tutorials
http://www.sdltutorials.com/
Getting Started With SDL
http://lazyfoo.net/tutorials/SDL/
TwinklebearDev SDL 2.0 Tutorial Index
Aaron's Game Programming Tutorials
http://aaroncox.net/tutorials/2dtutorials/index.html
http://aaroncox.net/tutorials/2dtutorials/sdlclasses.html
http://aaroncox.net/tutorials/2dtutorials/index.html
http://aaroncox.net/tutorials/2dtutorials/sdlclasses.html
The guide to implementing 2D platformers
http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/
SFML
http://www.sfml-dev.org/
SFML shaders
http://www.sfml-dev.org/tutorials/2.1/graphics-shader.php
Game Development Forum - C#
http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/
SFML
http://www.sfml-dev.org/
SFML shaders
http://www.sfml-dev.org/tutorials/2.1/graphics-shader.php
Game Development Forum - C#
http://jharbour.com/forum/index.php?PHPSESSID=tpi1cfdcj0pe61dfgnv9l3ami6&board=22.0
Pixeljoint - tutorials, pixelart etc.
http://pixeljoint.com/pixels/tutorials.asp
OpenGameArt
http://opengameart.org/content/lpc-tile-atlas
GameArt2D
http://www.gameart2d.com/tileset.html
A Basic Sprite Tutorial
http://2dwillneverdie.com/tutorial/a-basic-sprite-tutorial/
Sprites resource
http://gamedevelopment.tutsplus.com/articles/10-great-full-game-sprite-sheets-from-graphicriver--gamedev-3797
Tiled Map Editor (tile leveleditor)
http://www.mapeditor.org/
Introduction to Tiled Map Editor
http://gamedevelopment.tutsplus.com/tutorials/introduction-to-tiled-map-editor-a-great-platform-agnostic-tool-for-making-level-maps--gamedev-2838
Tileset creation guide
https://github.com/hawkthorne/hawkthorne-journey/wiki/Tileset-creation-guide
Game Programming Tutorials
http://www.dreamincode.net/forums/forum/108-game-programming-tutorials/
Game Engines - GitHub
https://github.com/showcases/game-engines
Pixeljoint - tutorials, pixelart etc.
http://pixeljoint.com/pixels/tutorials.asp
OpenGameArt
http://opengameart.org/content/lpc-tile-atlas
GameArt2D
http://www.gameart2d.com/tileset.html
A Basic Sprite Tutorial
http://2dwillneverdie.com/tutorial/a-basic-sprite-tutorial/
Sprites resource
http://gamedevelopment.tutsplus.com/articles/10-great-full-game-sprite-sheets-from-graphicriver--gamedev-3797
Tiled Map Editor (tile leveleditor)
http://www.mapeditor.org/
Introduction to Tiled Map Editor
http://gamedevelopment.tutsplus.com/tutorials/introduction-to-tiled-map-editor-a-great-platform-agnostic-tool-for-making-level-maps--gamedev-2838
Tileset creation guide
https://github.com/hawkthorne/hawkthorne-journey/wiki/Tileset-creation-guide
Game Programming Tutorials
http://www.dreamincode.net/forums/forum/108-game-programming-tutorials/
Game Engines - GitHub
https://github.com/showcases/game-engines
Subscribe to:
Posts (Atom)