Jump to content

  • Log In with Google      Sign In   
  • Create Account


True, False, FileNotFound

Posted by , 05 March 2012 - - - - - - · 1,796 views

Sigh. From the SDK of a certain big-name console:

enum GraphicsBoolean

Graphics's version of bool-type values.


That makes me sad.

EDIT: Censored the library name

You must enter an entry title longer than 2 characters

Posted by , 13 December 2011 - - - - - - · 393 views

I am drunk.

I like muffins.

That is all.

Preview of the game I'm working on

Posted by , 08 July 2011 - - - - - - · 381 views

IGN has released a preview of the game I'm working on: Need For Speed: The Run on 3DS. Obviously I can't say an awful lot about it, but the preview doesn't do it justice IMO - some of the tracks are much prettier than the screenshots there, and it doesn't cover some fun things like heroic stunts (Which you can see mentioned on the bottom screen in the second screenshot).

Anyway. Back to work. I need to tighten up the graphics on level 3.

I'm not dead!

Posted by , 24 June 2011 - - - - - - · 413 views

Last update was in January, whoops.

I've been pretty busy recently, been buying a 3 bedroom flat in Glasgow which is a lot more stressful than I thought it'd be.

I finally moved my stuff in at the start of June, after having fun trying to get a certificate of building works for the work that the previous owner did to the property. He moved the kitchen completely, put in an en-suite, and added an air duct to extract air from the en-suite, kitchen and bathroom and spew it into the stairwell. And there's the problem. The building certificate guy said that it can't vent into the stairwell, since it's a fire escape so it's a fire hazard - despite every other flat in the building doing the exact same thing. I was told that it would need to be re-ducted to an exterior wall, and was then told a week later that it'd been done. All this happened about 2 weeks before I was due to move in, after my offer had been accepted, so there wasn't a lot of time for me to argue it or anything like that.
So I officially moved in on the Friday, and I went to the flat on Saturday to see what had been done with the ducting. And it hadn't exactly been re-ducted, it'd been blocked up. I spoke with my solicitor who said that basically there's nothing we can do about it, because he has a certificate to say that the building works are carried out to code (They're not functional, but they're to code...). I spoke to the previous owner about it and he said that apparently this is just something that everyone does, and he's happy to unblock it if I want, so it'll vent back into the stairwell - which is against the building regulations and will need blocked up again if I sell the place, but at least it'll be functional.
So he came and did that, which took him 5 mins which was good-ish.

Other fun things I noticed after moving in is that the floors are a mess. It's laminate flooring, and it was in a reasonable state when I went to view the place in February, but the owner had tenants in during this time, and I stupidly didn't go to see it after they'd moved out. The floors weren't really that bad, but they were worse than when I saw it previously, with big cracks between the pieces of laminate in the hall, and a big spongy bit just as you enter the lounge. There was also a damp patch that wasn't visible before because it was behind a sofa. It was mentioned in the home report, but I assumed it was just a mark on a different wall (Same wall, but on the other side) that the owner said he was taking care of.

So, the current state of affairs: I got hardwood flooring from Direct Flooring and got it put in throughout, which is still a work in progress as we speak. It looks considerably better than the laminate, and the guys who put the flooring in (Area Joinery) have done a fantastic job. They've not done the flooring around the damp patch, because it'd just need ripped up again, so the plan is that I get the damp fixed, then they come back and do the rest as a separate, smaller job.
I got a quote from one builder for fixing the damp - who quoted £640 ex. VAT, so around £750 including VAT. The damp patch is pretty small, and is because it's just a plastered-over fireplace which hasn't been properly blocked up, so I think £750 is perhaps a bit steep. I also need to get a fireplace trimmed because the large concrete slab base of it is raised up above the floorboards so the flooring guys can't floor over it - thankfully it's the fireplace at the damp patch, so it couldn't be floored over anyway - but I don't think I'll be getting the £750 builder to do that somehow...
I was due to have another builder come and give me a quote last night, but he "forgot" apparently, and is supposed to phone me today but hasn't yet. So I might end up needing to find another builder instead...

On top of that I've been extremely busy at work, I can now say that I'm working on Need For Speed: The Run on the 3DS. And speaking of being extremely busy, now this has FINALLY finished compiling, I'm going to get back to it...

What! I need a title now?

Posted by , 19 January 2011 - - - - - - · 334 views

Well, I'm working on the new DirectX and XNA forum FAQ. The Previous FAQ is pretty massive, and out of date - although I suppose it needs to be quite wordy to cover all of the DirectX API...

I'm also beginning to realise how out of date I am, having never used Direct3D 10, 10.1 or 11, or Direct2D or DirectWrite. Which makes the FAQ on those sections a bit lacking...

Despite me saying that I'd try and have the FAQ done by Monday (2 days ago), It'll be done "when it's done" - although unlike my tutorial stuff, I'm actively working on the FAQ, and hope to have a first draft done by this weekend (maybe...).

I'm making my own cider at home. Which should be ready soon (might be ready now in fact). It took a bit longer than it was supposed to, due to me adding honey as well as sugar initially (Since I didn't trust the look or smell of it), and it not being at the correct temperature - I don't have anywhere that's a constant 25'C, the closest to that is next to my radiator, which is far from ideal...
So anyway, I've brewed it and bottled it (I've been collecting bottles for a while, and I got a bottle capper and bottle caps), it now needs to sit somewhere at ~30'C for 3 days to prime (So I'm leaving it next to the radiator for a week), and then it'll be done.

I have a stag doo for one of my friends on Saturday, so that's Saturday gone and Sunday will probably be spent recovering, so I doubt I'll get anything constructive done at the weekend.

Anyway, end of lunch, time for me to get back to work. Joy joy joy...

If you've got monkeys on the knees, just say Thynn

Posted by , 29 December 2010 - - - - - - · 402 views

I'm not dead! Again.

I've not been doing an awful lot of my own stuff recently, I've been particularly busy with work stuff - as usual.

We got one of our projects (On two platforms) canned unfortunately, especially since we'd been working on it for over a year. I can't say much more about it for obvious reasons.

I'm currently dicking around doing some stuff like Microsoft's Detours library, just because I like doing fun low-level stuff like this. I've gone back to my APIHijack app that I wrote a while ago (Might be linked in a previous entry, PM me if it's not and you especially want the source), that lets me redirect calls to any call made from an EXE (or DLL) to another DLL to my own function.
That works by injecting a DLL into a remote process, via the usual CreateRemoteThread method, but the problem is that you can only do any real "work" in DllMain, or when a patched API call is made. Doing stuff in DllMain has several well known problems (The loader lock), and doing stuff in a patched API call might not be practical for various reasons.

So, the obvious solution is to use an initialisation function, which is called after the DLL has been loaded. The problem is calling that function, since it needs to be called from within the target process. That means that you need to do a GetProcAddress() in the remote process to get the address of the initialisation function, which isn't directly possible (It rather involved being on the other side of this airtight hatchway).

So, I've now written a GetRemoteProcAddress function, which uses ReadProcessMemory to parse the PE header and read the exports section (Which is what GetProcAddress does internally anyway).

So, for anyone who cares:

FARPROC GetRemoteProcAddress(HANDLE hProcess, HMODULE hDll, const char* szFunc)
// Read and check the DOS and NT headers
BYTE* pBaseAddress = (BYTE*)hDll;
SIZE_T nBytesToRead = sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS) + 4096;
BYTE* pBuffer = new BYTE[nBytesToRead];
SIZE_T nBytesRead = 0;
if(!ReadProcessMemory(hProcess, pBaseAddress, pBuffer, nBytesToRead, &nBytesRead) ||
nBytesRead != nBytesToRead)
delete[] pBuffer;
return NULL;
if(pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE || pDOSHeader->e_lfanew < 0 ||
(DWORD)pDOSHeader->e_lfanew > nBytesToRead-sizeof(IMAGE_NT_HEADERS))
delete[] pBuffer;
return NULL;
IMAGE_NT_HEADERS* pNTHeader = (IMAGE_NT_HEADERS*)(pBuffer + pDOSHeader->e_lfanew);
if(pNTHeader->Signature != IMAGE_NT_SIGNATURE)
delete[] pBuffer;
return NULL;

// Get export data directory
IMAGE_OPTIONAL_HEADER& optionalHeader = pNTHeader->OptionalHeader;
DWORD dwExportRVA = optionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
if(optionalHeader.NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_EXPORT || dwExportRVA == 0)
delete[] pBuffer;
return NULL;

// Read export directory header
delete[] pBuffer;
if(!ReadProcessMemory(hProcess, pBaseAddress + dwExportRVA, &exportDirectory,
sizeof(exportDirectory), &nBytesRead) || nBytesRead != sizeof(exportDirectory))
return NULL;

// Find this functions ordinal
WORD wFunctionIndex = 0xffff;
if((DWORD)szFunc < 0xffff)
// Function name passed as an ordinal
wFunctionIndex = (WORD)szFunc - (WORD)exportDirectory.Base;
DWORD dwFunctionOrdinalIndex = exportDirectory.NumberOfFunctions;

// Read export names table
DWORD* pNameRVAs = new DWORD[exportDirectory.NumberOfNames];
if(!ReadProcessMemory(hProcess, pBaseAddress + exportDirectory.AddressOfNames, pNameRVAs,
exportDirectory.NumberOfNames*sizeof(DWORD), &nBytesRead) ||
nBytesRead != exportDirectory.NumberOfNames*sizeof(DWORD))
delete[] pNameRVAs;
return NULL;

// Search the name table for this function
for(DWORD i=0; i<exportDirectory.NumberOfNames; ++i)
// Read this export name
char szBuff[128];
if(!ReadProcessMemory(hProcess, pBaseAddress + pNameRVAs[i], szBuff, sizeof(szBuff),
delete[] pNameRVAs;
return NULL;
if(nBytesRead < sizeof(szBuff))
szBuff[nBytesRead] = 0;

// Is this the one we want?
if(strcmp(szBuff, szFunc) == 0)
dwFunctionOrdinalIndex = i;
delete[] pNameRVAs;

// Lookup this function in the ordinal table
if(dwFunctionOrdinalIndex >= exportDirectory.NumberOfFunctions)
return NULL;
pBaseAddress + exportDirectory.AddressOfNameOrdinals + dwFunctionOrdinalIndex*sizeof(WORD),
&wFunctionIndex, sizeof(wFunctionIndex), &nBytesRead) ||
nBytesRead != sizeof(wFunctionIndex))
return NULL;
if(wFunctionIndex >= exportDirectory.NumberOfFunctions)
return NULL;

// Read the export RVA in the export table
DWORD dwFunctionRVA;
pBaseAddress + exportDirectory.AddressOfFunctions + wFunctionIndex*sizeof(DWORD),
&dwFunctionRVA, sizeof(dwFunctionRVA), &nBytesRead) ||
nBytesRead != sizeof(dwFunctionRVA))
return NULL;

// Convert RVA to FARPROC
return (FARPROC)(pBaseAddress + dwFunctionRVA);

Not very well tested, and it could be a bit more optimal, but it does the job - especially if there's only a handful of exports.

Anyway, that's enough of my rambling for now. I'm returning to bed - I have the plague. Or flu. But I'm pretty sure it's the plague.


Posted by , 26 October 2010 - - - - - - · 214 views

<3 Pandy

<Pandy> so there was this ad on gumtree
<Pandy> for a fireplace
<Pandy> we emailed them and asked for a picture of somebody standing next to the fireplace
<Pandy> and they sent us this kind of miserable looking woman standing next to it looking sad and wistful
<Pandy> so we wrote a song about it and sent it to them
<Pandy> http://pigeonfancier.bandcamp.com
<Pandy> we made up this huge story about the fireplace
<Pandy> how it was his father's life work
<Pandy> but his new wife didn't like it
<Pandy> so she was forcing him to sell it
<Pandy> just checked our inbox on my phone
<Pandy> the reply:


Posted by , 06 September 2010 - - - - - - · 247 views



In the actual example, j was about 10 lines further down than i, so I could only see the j. Hooray for 30 minutes of wasted debugging.