http://www.gamedev.net/topic/666362-how-to-implemnt-lighting-in-2d-sdl-game/
http://gamedev.stackexchange.com/questions/80099/is-sdl2-alone-capable-of-dynamic-or-deferred-lighting
http://www.devshed.com/c/a/multimedia/basic-lighting-in-opengl-and-sdl-game-programming/
http://konradjablonski.co.uk/real-time-2d-lighting/
https://www.reddit.com/r/gamedev/comments/1tbllz/handling_2d_lights_sdl2/
http://stackoverflow.com/questions/3978529/2d-light-effect-with-sdl
https://www.google.com/#q=SDL+GAME+LIGHTING
https://www.google.com/#q=sdl+dynamic+lighting
https://www.youtube.com/watch?v=GXQhpLjsSmc
https://www.kickstarter.com/projects/finnmorgan/sprite-lamp-dynamic-lighting-for-2d-art
C++ Graphics Libs: SDL vs. SFML
https://facepunch.com/showthread.php?t=1284788
Note-to-self, Research, Game programming (mainly c++ sdl), Programming, Application development, Resource, Computer tech, Hex'n'hax ++
Monday, 19 October 2015
Tuesday, 13 October 2015
SDL OpenGL
http://lazyfoo.net/tutorials/SDL/50_SDL_and_opengl_2/
General tutorials including OpenGL
https://wiki.libsdl.org/Tutorials
Graphics Programming in C and C++, OpenGL, SDL, 3d rotation
http://www.cprogramming.com/graphics-programming.html
General OpenGL
https://it-ebooks.info/tag/opengl/
General tutorials including OpenGL
https://wiki.libsdl.org/Tutorials
Graphics Programming in C and C++, OpenGL, SDL, 3d rotation
http://www.cprogramming.com/graphics-programming.html
General OpenGL
https://it-ebooks.info/tag/opengl/
Monday, 5 October 2015
Add new modules/functions, gravity, climbing.
Since we don't want gravity or climbing all over the map/level, we can define areas where these things are active.
* Gravity area; when player is in this area or when player press jump button, gravity is activated.
When jumping (right before player leaves ground/floor), get players initial Y-pos, then check for colliding areas to land on, if none, return to inital Y-pos after doing jump cycle. This way we can have jump in x,y,z dimensional playing field.
Same goes for falling, if player is in gravity area and player is falling, just check for colliding sprites on the way down.
* Climbing area; when player is in this area, the player can climb a ladder/wall.
We can use sprites (opaque layered maybe) to define these areas, and then check for collision with the player sprite, if they collide then do actions/motions. Or we can define positions (x,y,width,height) on the map where these things are active.
Although sprites maybe easier to work with in case of editing and moving things around on the map, don't need to hardcode the positions.
* Gravity area; when player is in this area or when player press jump button, gravity is activated.
When jumping (right before player leaves ground/floor), get players initial Y-pos, then check for colliding areas to land on, if none, return to inital Y-pos after doing jump cycle. This way we can have jump in x,y,z dimensional playing field.
Same goes for falling, if player is in gravity area and player is falling, just check for colliding sprites on the way down.
* Climbing area; when player is in this area, the player can climb a ladder/wall.
We can use sprites (opaque layered maybe) to define these areas, and then check for collision with the player sprite, if they collide then do actions/motions. Or we can define positions (x,y,width,height) on the map where these things are active.
Although sprites maybe easier to work with in case of editing and moving things around on the map, don't need to hardcode the positions.
Tuesday, 29 September 2015
Problem finally solved. SDL TTF now working!
I think my main problem was I was using old version of SDL_TTF(old 1.2 version ) with SDL2.
I got passed the TTF_INIT() and it returned 0 which means that it was initialized ok.
I even checked TTF_WasInit() and that was also ok saying it was already loaded.
But when I tried opening a font with this code:
and TTF_GetError() was empty (opaque,blank,displayed nothing)
also got NO compile errors and the executable ran correctly, but wouldn't load the font.
The solution for me was:
* Dowloaded the SDL_TTF sources again to have fresh and latest files, newest version that goes with latest SDL2.
* Made a new SDL include and lib folder, copied the correct files to those folders,
just to be sure that it was setup right.
* Added those folders to VC++ include and library directories selection in VS2010C++ project properties.
* Redid the compiler "additional c/c++ linker" again in VS2010C++ project properties now adding all the SDL stuff at the end of the list, making sure the kernel32.lib and all regular systemlibs was at the top of the list.
Then cleaned build, compiled and rebuild, ran the executable and then it worked loading a font and displayed text!
Think the "moral of the story" is: check that your linker is correctly setup AND that you're using the LATEST SDL2 versions of the files for both SDL2 main files and the extension library files....
Now I can finally have TEXT in the game... :) (Spent toooo many hours on this "little" #$*&! problem)
I stumbled upon this link that lead me to solving it:
http://www.gamedev.net/topic/649984-sdl2-ttf-issues-entry-point-not-found-visual-studio/
I got passed the TTF_INIT() and it returned 0 which means that it was initialized ok.
I even checked TTF_WasInit() and that was also ok saying it was already loaded.
But when I tried opening a font with this code:
TTF_Font* fFont = 0;
fFont = TTF_OpenFont("./sample.ttf", 12); //open a fontfile and set fontsize
if(fFont == NULL) //check if fFont is NULL, if so output error message
{
std::cout << "Font: " << fFont << std::endl;
std::cout << "TTF_OpenFont: " << TTF_GetError() << std::endl;
}
it returned NULL and variable fFont displayed 00000000and TTF_GetError() was empty (opaque,blank,displayed nothing)
also got NO compile errors and the executable ran correctly, but wouldn't load the font.
The solution for me was:
* Dowloaded the SDL_TTF sources again to have fresh and latest files, newest version that goes with latest SDL2.
* Made a new SDL include and lib folder, copied the correct files to those folders,
just to be sure that it was setup right.
* Added those folders to VC++ include and library directories selection in VS2010C++ project properties.
* Redid the compiler "additional c/c++ linker" again in VS2010C++ project properties now adding all the SDL stuff at the end of the list, making sure the kernel32.lib and all regular systemlibs was at the top of the list.
Then cleaned build, compiled and rebuild, ran the executable and then it worked loading a font and displayed text!
Think the "moral of the story" is: check that your linker is correctly setup AND that you're using the LATEST SDL2 versions of the files for both SDL2 main files and the extension library files....
Now I can finally have TEXT in the game... :) (Spent toooo many hours on this "little" #$*&! problem)
I stumbled upon this link that lead me to solving it:
http://www.gamedev.net/topic/649984-sdl2-ttf-issues-entry-point-not-found-visual-studio/
Monday, 28 September 2015
Thursday, 24 September 2015
SDL render text issue - not appearing
text not appearing, is it z-indexed behind other layers? compile is fine.
maybe need to make placeholder sprite and then render text to it, and then to screen?
is
need to check it out.
EDIT:
Seems the font is not loaded ! Getting errors...
Need to make own renderfunction, only load font one time and reference to it.
..found this need to check it out:
http://www.willusher.io/sdl2%20tutorials/2013/12/18/lesson-6-true-type-fonts-with-sdl_ttf/
*** UPDATE ***
This problem has now been solved, read post: http://olejeek.blogspot.com/2015/09/sdl-ttf-now-working-problem-solved.html
maybe need to make placeholder sprite and then render text to it, and then to screen?
is
SDL_RenderCopy(renderer, Message, NULL, &Message_rect);
placement right in the code?need to check it out.
EDIT:
Seems the font is not loaded ! Getting errors...
Need to make own renderfunction, only load font one time and reference to it.
..found this need to check it out:
http://www.willusher.io/sdl2%20tutorials/2013/12/18/lesson-6-true-type-fonts-with-sdl_ttf/
*** UPDATE ***
This problem has now been solved, read post: http://olejeek.blogspot.com/2015/09/sdl-ttf-now-working-problem-solved.html
Saturday, 19 September 2015
Thursday, 17 September 2015
Pixel Art tutorials
http://www.hongkiat.com/blog/pixel-art-tutorials/
http://makegames.tumblr.com/post/42648699708/pixel-art-tutorial
http://www.pixelprospector.com/the-big-list-of-pixel-art-tutorials/
http://design.tutsplus.com/tutorials/kandi-runner-create-a-pixel-art-sprite-from-scratch--cms-21705
http://www.slant.co/topics/1547/~pixel-art-sprite-editors
https://www.reddit.com/r/gamedev/comments/28vv5w/aseprite_an_amazing_offline_pixel_art_editor/
http://makegames.tumblr.com/post/42648699708/pixel-art-tutorial
http://www.pixelprospector.com/the-big-list-of-pixel-art-tutorials/
http://design.tutsplus.com/tutorials/kandi-runner-create-a-pixel-art-sprite-from-scratch--cms-21705
http://www.slant.co/topics/1547/~pixel-art-sprite-editors
https://www.reddit.com/r/gamedev/comments/28vv5w/aseprite_an_amazing_offline_pixel_art_editor/
Wednesday, 16 September 2015
Some thoughts about SDL texture and sprite z-index
...and a solution ("painters solution").
I've read and heard that SDL don't have any real z-index when it comes to render image on screen,
the last drawn image/sprite/texture has the highest z-index. That got me thinking of a way to correct it.
In a X,Y,Z graphics environment we can correct the z-index like this:
The bigger the number of y-pos is = the bigger the z-index is
or in other words: z-index = y-pos + spriteHeight;
(In most cases you need to add sprite height to y-pos to get the real y-pos, and your sprites need to be cropped/trimmed from unnecessary transparent height so the bottom of the sprites are accurate)
Some pseudo code to explain solution:
Final coding (c++):
This is what I ended up doing: basically comparing 2 vectors and redraw textures in right order.
Here's my code, I run it last/at the bottom in my gameloop render function,
but surely this can/should be included to the default render function as a permanent part:
I've read and heard that SDL don't have any real z-index when it comes to render image on screen,
the last drawn image/sprite/texture has the highest z-index. That got me thinking of a way to correct it.
In a X,Y,Z graphics environment we can correct the z-index like this:
The bigger the number of y-pos is = the bigger the z-index is
or in other words: z-index = y-pos + spriteHeight;
(In most cases you need to add sprite height to y-pos to get the real y-pos, and your sprites need to be cropped/trimmed from unnecessary transparent height so the bottom of the sprites are accurate)
Some pseudo code to explain solution:
if(object.A.pos.y > object.B.pos.y)
{
redraw(object.B);
redraw(object.A);
}
else if(object.A.pos.y < object.B.pos.y)
{
redraw(object.A);
redraw(object.B);
}
Final coding (c++):
This is what I ended up doing: basically comparing 2 vectors and redraw textures in right order.
Here's my code, I run it last/at the bottom in my gameloop render function,
but surely this can/should be included to the default render function as a permanent part:
/////////////////////////////////////////////////////////////////////////////////////////////////////
//A little sorter-helper function
bool howToSort(int i, int j) { return i < j; }
/////////////////////////////////////////////////////////////////////////////////////////////////////
//A function to get z-index from object, defined in a header file
//It's made out from a getPosition.getY() function and a class member int m_objHeight
int getZindex() { return getPosition().getY() + m_objHeight; }
/////////////////////////////////////////////////////////////////////////////////////////////////////
//Redraw objects to correct the z-index of all screen objects/sprites/textures
//The parameter is a vector of GameObjects (class that makes up the objects)
void RedrawObjectZindex(const std::vector<GameObject*> &objects)
{
//Declare a vector of integers to hold all objects z-indexes
std::vector<int> v_zindex;
for(int i=0; i < objects.size(); i++)
{
//In my case I omit the background image object, it's always going to have the highest zindex,
//(largest height+ypos), so I avoid it. (Its textureID=background)
//objID() is a function that gets the objects textureID
if(objects[i]->objID() !="background")
{
//Add each objects z-index to the v_zindex vector
v_zindex.push_back(objects[i]->getZindex());
}
}
//Sort the vector from lowest to highest zindex
sort( v_zindex.begin(), v_zindex.end(), howToSort );
//Now we redraw objects in correct order by comparing the sorted z-indexes
//with objects ypos+height. By drawing the lowest first (smallest value) and
//highest last (biggest value), we correct the zindex and "depth" is achieved.
for(int i=0; i < v_zindex.size(); i++)
{
for(int j=0; j < objects.size(); j++)
{
if(v_zindex[i] == objects[j]->getZindex())
{
//draw() is a function that draws textures to screen
objects[j]->draw();
}
}
}
//Clean up this vector
v_zindex.clear();
}
Tuesday, 15 September 2015
Monday, 14 September 2015
Rendering text in SDL2
http://stackoverflow.com/questions/22886500/rendering-text-sdl2
Example 1:
Example 1:
//this opens a font style and sets a size
TTF_Font* Sans = TTF_OpenFont("Sans.ttf", 24);
//this is the color in rgb format, maxing out all would give
//you the color white, and it will be your text's color
SDL_Color White = {255, 255, 255};
//as TTF_RenderText_Solid could only be used on SDL_Surface
//then you have to create the surface first
SDL_Surface* surfaceMessage = TTF_RenderText_Solid(Sans, "put your text here", White);
//now you can convert it into a texture
SDL_Texture* Message = SDL_CreateTextureFromSurface(renderer, surfaceMessage);
SDL_Rect Message_rect; //create a rect
Message_rect.x = 0; //controls the rect's x coordinate
Message_rect.y = 0; // controls the rect's y coordinte
Message_rect.w = 100; // controls the width of the rect
Message_rect.h = 100; // controls the height of the rect
//Mind you that (0,0) is on the top left of the window/screen,
//think a rect as the text's box, that way it would be very simple to understance
//Now since it's a texture, you have to put RenderCopy in your
//game loop area, the area where the whole code executes
//you put the renderer's name first, the Message, the crop size
SDL_RenderCopy(renderer, Message, NULL, &Message_rect);
//(you can ignore this if you don't want to dabble with cropping),
//and the rect which is the size and coordinate of your texture
Example 2:std::string score_text = "score: " + std::to_string(score);
SDL_Color textColor = { 255, 255, 255, 0 };
SDL_Surface* textSurface = TTF_RenderText_Solid(font, score_text.c_str(), textColor);
SDL_Texture* text = SDL_CreateTextureFromSurface(renderer, textSurface);
int text_width = textSurface->w;
int text_height = textSurface->h;
SDL_FreeSurface(textSurface);
SDL_Rect renderQuad = { 20, win_height - 30, text_width, text_height };
SDL_RenderCopy(renderer, text, NULL, &renderQuad);
SDL_DestroyTexture(text);
Saturday, 5 September 2015
C++ : Classes
There's several ways to pass variables between classes, but I still haven't found a 100% solution to this.
Sometimes things work, sometimes compiler won't compile usually gives "blahblah a non static member...error" or "blahblah cannot resolve external symbol...error".
Sometimes you just need a variable to be in the global scope...
..using the extern keyword:
http://www.cplusplus.com/forum/general/21368/
other stuff:
http://www.cplusplus.com/doc/tutorial/classes/
http://www.learncpp.com/cpp-tutorial/82-classes-and-class-members/
http://www.learncpp.com/cpp-tutorial/813-friend-functions-and-classes/
Below is another example of how to use static variables in multiple files and classes,
in other words: read/write/update variable between files and classes. "Global" access.
Sometimes things work, sometimes compiler won't compile usually gives "blahblah a non static member...error" or "blahblah cannot resolve external symbol...error".
Sometimes you just need a variable to be in the global scope...
..using the extern keyword:
http://www.cplusplus.com/forum/general/21368/
//FILE: includes.h
//extern tells the compiler that the variable is defined
//somewhere else, so it doesn't complain about it being undefined.
extern int count;
//FILE: main.cpp
#include "includes.h"
int count = 4;
//FILE other.cpp
#include "includes.h"
std::cout << count << std::endl;// will output 4
other stuff:
http://www.cplusplus.com/doc/tutorial/classes/
http://www.learncpp.com/cpp-tutorial/82-classes-and-class-members/
http://www.learncpp.com/cpp-tutorial/813-friend-functions-and-classes/
//C++ How to control variables between classes
//first define your prototype variable and functions (static)
//in a header file:
//example.h
class ScrollingBackground
{
public:
static bool m_bScroll;
static void scrollOn();
static void scrollOff();
}
//Then in the example.cpp file declare a variable to "activate" it
//preferebly in the top section
//example.cpp
bool ScrollingBackground::m_bScroll = true;
void scrollOn()
{
ScrollingBackground::m_bScroll = true;
}
void scrollOff()
{
ScrollingBackground::m_bScroll = false;
}
//Then use #include "example.h" in any file you'd
//like to use the functions scrollOn and scrollOff
//and you can control the variable m_bScroll
Another example to "share" variables between classes use the "friend" syntax:class Accumulator
{
private:
int m_nValue;
public:
Accumulator() { m_nValue = 0; }
void Add(int nValue) { m_nValue += nValue; }
//Make the Reset() function a friend of this class
friend void Reset(Accumulator &cAccumulator);
}
//Reset() is now a friend of the Accumulator class
void Reset(Accumulator &cAccumulator)
{
//And can access the private data of Accumulator objects
cAccumulator.m_nValue = 0;
}
Below is another example of how to use static variables in multiple files and classes,
in other words: read/write/update variable between files and classes. "Global" access.
////////////////////////////////////////////////////////////////////
//define prototype variables and functions in the public section of your class Player.h
public:
static int m_iXPlayer;
static int m_iYPlayer;
//their values can be accessed in other files if #include "Player.h" is used
//IMPORTANT! need to be declared at the top in player.cpp file TO BE ACTIVATED
//and important to use syntax: variableType className::variableName = value;
//like below. If not the compiler will give you error: cannot resolve external symbol (blabla@..)
int Player::m_iXPlayer = 0;
int Player::m_iYPlayer = 0;
//they can then be used/updated in Player.cpp
//and then you can read their value in other files and classes
//one way to access their values in other classes is using them in functions and return their value
//in another file named example.h
#include "player.h"
class example
{
public:
int iGetX(){return Player::m_iXPlayer;}
int iGetY(){return Player::m_iYPlayer;}
}
//then use iGetX() and iGetY() in your code to get the values of the variables
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)