Friday 30 May 2014

Debugging an EXE in Visual Studio

Select File > Open > Project / Solution and select the EXE.
This will create a blank solution with the EXE in it.
Then Start Debugging to run the EXE.
Create a breakpoint and inspect the stack as normal. Note that the addresses shown will be the memory addresses, not the file addresses.

Playing Star Wars - Battlefront without the CD

To play Star Wars Battlefront without having to keep the CD in the drive all the time.

1. Hex Edit (using something like HxD) the file at C:\Program Files (x86)\LucasArts\Star Wars Battlefront\GameData\battlefront.exe

2. Search for the hex data E8 79 FE FF FF - you should find it at address 001ECED2 or similar.

3. Edit the preceding two bytes from Jump If Not Equal (JNE) - to Jump.
In other words: change the two bytes at address 001ECED2 from 75 0F to EB 0F.

4. Save the modified file.

5. Change the shortcut to C:\Program Files (x86)\LucasArts\Star Wars Battlefront\GameData\battlefront.exe.

Monday 26 May 2014

OpenBVE - An attempt was made to load a program with an incorrect format, SDL failed to create window

If you get the error message

"An attempt was made to load a program with an incorrect format" when starting OpenBVE, make sure you have installed OpenAL via the installer.

"SDL failed to create window" - this can be because you've copied the installation from one machine to another and the resolution is set wrong. Go into the options and set the correct resolution.

Wednesday 14 May 2014

Rooting a Samsung Galaxy Tab 3 10.1 - What they don't tell you

I've spent a few hours trying to root a Samsung Galaxy Tab 3.0 10.1 following instructions on the Internet. There are a few little gotchas that aren't made clear.

- You only get one chance to boot to the CWM recovery after you've flashed the device
- You don't need to press the HOME button when starting the boot

So, here is my version of the instructions:

Preparation

1. Turn on Developer Mode.
If not done already, click on Settings->About Device->Build number->Build number->Build number 
and press Build number" seven times. 
2. Turn on USB debugging.

3. Download Odin (3.07 or higher) and save it to your desktop. 
4. Download CWM Recovery and save it to your Desktop.
5. Download Root ZIP and save it to your Desktop.

Flashing

1. Extract files from Odin and CWM Recovery archives by right-clicking on each of them and selecting Extract here.
2. Open Odin ensuring you "Run as administrator".
3. Click on PDA and choose the CWM Recovery file you just extracted from the archive.
4. Make sure only the F. Reset Time boxes are checked in the Odin. De-select Auto-Reboot - otherwise you will have to be quick at engaging recovery mode. If you aren't you will end up in Android recovery, not CWM.
5. Turn OFF your device.
6. Turn it back on by holding down Volume DOWN+Power buttons together.
7. Your device should reboot into Download mode.
8. Plug in your device to your PC via USB cable.
9. Hit Start in the Odin and it’ll start flashing the recovery on your device.
10. Connect your device to your PC using the USB cable.
11. Copy the Root ZIP file from your Desktop over to the root of your SD card. Note: the SD card. Not internal memory. You will need an SD card.
12. Open a command prompt in administrator mode. Go to the android platform-tools folder and type adb reboot recovery. Alternatively turn OFF the device and turn it back on by holding down Volume UP + Power buttons together.
13. Your device should reboot into recovery mode.
14. Select install zip from sdcard followed by choose zip from sdcard.
15. Choose Root ZIP to be flashed on your device.
16. It should start flashing the file on your device.
17. Once the flashing’s done, reboot your device.
18. Go back to the menu and select reboot. If it asks you "ROM may flash stock recovery on boot. Fix?" then it will be asking you whether to reapply the stock recovery. Select Yes to keep CWM or No to return to android recovery.

Problems?

Odin stuck at initializing connection? - You didn't boot the device into download mode (POWER + VOL DOWN).
You keep booting to android recovery rather than cwm recovery? - When you've flashed using Odin it starts to automatically reboot by default. You only have the one chance to press POWER + VOL UP to enter recovery mode. If you don't do it and it goes to the normal power up sequence then install-recovery.sh will replace cwm with the stock recovery. Turn off the Auto-Reboot option in Odin and perform the reboot yourself.

Stock firmware
Stock firmware is available from the this site.

Monday 5 May 2014

Minecraft and Multiple versions of Forge and mods

Minecraft enables you to play multiple versions of the program and multiple versions of mods.

Installing Forge

Forge is a useful utility which enables the easy addition of mods. You no longer need to copy Java class files into the .minecraft folder and delete the META-INF folder. Instead you install Forge and then copy files to a mods folder.

You can download Forge from here.

The following instructions are courtesy of mod-buildcraft.com:

Go to http://files.minecraftforge.net/ and download the installer recommended for Minecraft 1.6.4. The download link is going to bring you to an adfly link that might look weird at first. This is a sponsored link used to remunerate the developers of the Forge for the work they're doing. You should see a page like this (probably with a different advertisement in the body):
Note that on the top right corner, the count-down for the download. Just wait the 5 seconds, until the top looks like:
Then click on the “Skip Ad” link. This should download a file with the .jar extension. Click on it. You should get the following installer:
Click on OK on the bottom left corner, up until the success message. Then open the Minecraft lobby again, and switch profile to the Forge profile:
Hit play. The Minecraft lobby will then offer to log on the Forge profile with the same user as the one currently registered. Hit Play again to validate it:
And then back to the lobby, hit Play one last time. You should now see a Minecraft menu with Forge details displayed:
That's it! You successfully installed Minecraft Forge. Close Minecraft for now.

Multiple verions of Forge and Mods

When using Forge and the Minecraft launcher, by default all mods are stored in

%appdata%\.minecraft\mods

This is the global mod folder. However it will cause problems if you put a 1.6.4 and a 1.7.2 mod in here.
To get around this, use the GameDir setting in Minecraft.


Create a folder, such as %appdata%\.minecraft\mods\GameDir\Forge 1.6.4. Set the folder to this.
Run Minecraft again and it will create a set of subfolders within this, including the mods folder.
Put your version-specific mods in here.