Enabling VT-X on Vaio laptops.

As many of you may know, Sony has disabled hardware assisted virtualization on most, if not all, their Vaio branded laptops. This is a pain in the arse when you need to run programs which need hardware assisted virtualization like, VMWare, VirtualBox and Microsoft’s XP mode for Windows 7.

Here’s what I did to enable it (briefly):

  1. Make sure your CPU can actually support VT-x. Most Core 2 Duo and newer CPUs should be compatible.
  2. Created a bootable USB DOS startup disk.
  3. Added the SYMCMOS program to it.
  4. Booted into the DOS environment and ran the SYMCMOS program.
  5. Edited the outputted file. You have to find the register to edit and change the [0000] to [0001]. In my case, my Vaio was a CR353 so the register I had to change was 05BB. A comprehensive table of all the BIOSes of the Vaios can be found here.
  6. Saved the file back onto the NVRAM
  7. Reboot.

That’s briefly what I did to enable VT-x on my machine. You can find a more thorough guide here.

I can now virtualize 64bit OSes and run Microsoft’s XP Mode. Have fun.

Please note that although this shouldn’t brick your computer completely (if it doesn’t boot, just remove the CMOS battery for a minute and put it back in) but in the slight chance it does, I accept no responsibility for damages caused. Use at your own risk.

Making an RPG ‘talk box’ in GML.

Here’s how I achieved making a ‘talk box’ in GML for RPGs.

Create a new script called talkObjInit. Call this script in the Create event of your talk controlling object. It’s best if you dedicate an object for this purpose rather than ‘attaching’ the talk scripts onto an existing object. That being said though, if you’re careful, there shouldn’t be any reason not to. You’ll also need an alarm event dedicated to it. If you dedicated an object to this and your alarm number is 0, call talkObjInit(instant_id,0).

/* talkObjInit
arg0 = id of instance to initialize
arg1 = alarm number for the ticker.
Returns true if successful.
*/
talkObjId = argument0;
if (!instance_exists(talkObjId))
{ show_debug_message("talkObj: Instance ID does not exist"); return false; }

talkObjId.talkObjAlarmNumber = argument1;

/*Internal Variables. You shouldn't change em*/
talkObjId.talkObjMsgQueue = ds_queue_create(); //Set up a queue for the messages.
/*Changeable Internal Variables*/

talkObjId.talkObjScrollSpeed = 1; //How many steps to take before the next character appears
/*Temporary Variables. Definitely shouldn't be changed*/
talkObjId.talkObjTmpCharQueue = ds_queue_create(); //Set up a queue for the characters.
talkObjId.talkObjTmpText = ""; //Somewhere to store the text generated for the draw event
talkObjId.talkObjTmpCanMove = true; //Whether the character can scroll to the next message
return true;

Another script called talkObjAlarmTick. Call this script in an alarm (the number should be defined in the init script). So if you specified 0 in the init function, call this script from there.

/*talkObjAlarmTick
arg0 = id of the controlling object
Returns true if successful
*/
talkObjId = argument0;
if (!instance_exists(talkObjId))
{ show_debug_message("talkObj: Instance ID does not exist"); return false; }

if (ds_queue_empty(talkObjId.talkObjTmpCharQueue))
{
   talkObjId.talkObjTmpCanMove = true;
}else{
talkObjId.talkObjTmpText = talkObjId.talkObjTmpText + ds_queue_dequeue(talkObjId.talkObjTmpCharQueue)
alarm[talkObjId.talkObjAlarmNumber] = talkObjId.talkObjScrollSpeed;
}
return true;

Another script called talkObjNext Place this in the event when the player needs to scroll to the next message. The ‘use’ key is a great one to do. I put mine in the Keyboard Release event for Enter but is totally up to you.

/*talkObjNext
arg0 = id of the controlling object
*/
talkObjId = argument0;
if (!instance_exists(talkObjId))
{ show_debug_message("talkObj: Instance ID does not exist"); return false; }

if (talkObjId.talkObjCanMove && !ds_queue_empty(talkObjId.talkObjMsgQueue))
{
ds_queue_clear(talkObjId.talkObjTmpCharQueue);
talkObjId.talkObjTmpNextStr = ds_queue_dequeue(talkObjId.talkObjMsgQueue);
if (string_char_at(talkObjId.talkObjTmpNextStr,1) == "&") //Evaluate all strings with a & ahead of it
{
execute_string(string_copy(talkObjId.talkObjTmpNextStr,2,string_length(talkObjId.talkObjTmpNextStr)))
}else{
for (i=0; i

And another script called talkObjEnqueueMessage Almost self explanatory of what this does. Basically when you want a new message to be displayed to the user, call this function.

/*talkObjEnqueueMessage
arg0 = id of the controlling object
arg1 = message (# for newline)
*/
talkObjId = argument0;
if (!instance_exists(talkObjId))
{ show_debug_message("talkObj: Instance ID does not exist"); return false; }

ds_queue_enqueue(talkObjId.talkObjMsgQueue,argument1);

And finally a drawing script which you'll have to make. Since I don't know the graphics background of your game, I cannot say on what to add here. Put this in the draw event talkObjDraw

/*talkObjDraw (template)
arg0 = id of the controlling object
*/
talkObjId = argument0;
if (!instance_exists(talkObjId))
{ show_debug_message("talkObj: Instance ID does not exist"); return false; }

/* BYO CODE */
//Draw a rectangle
//Draw the text talkObjId.talkObjTmpText inside the rectangle
if (!ds_queue_empty(talkObjId.talkObjMsgQueue))
{
    //Draw a sprite somewhere indicating that there are messages to be viewed
}

I should also add that any line with the first character being '&' will be executed so remember to validate user input (otherwise it's vulnerable to arbitrary code execution similar to a SQL injection attack). The function is for when, for example, you want to change rooms after the character finished reading a particular line.

I adapted these code from my own implementation and haven't tested it yet. It's also made to work on most games. Please do read through the code and understand why I did what. Then, you can try implement a custom solution for your game which will probably be more optimal.

It's far from perfect so feel free to email me if you have a better or cleaner suggestion.