Saturday, June 28, 2008

Renovate - Fixing the Windows

The windows in the kitchen have shown signs of age for quite a while.
It's time to fresh them up abit.

The handles are "broken". Going to replace them.
Each piece cost ~S$2.

The rubber gasket are also dead and need to be replaced.
There are plenty types and the original are "ribbed section" (based on http://www.trimlok.com/rubber_seal.aspx)

Could also found the "Truckbed seal" type in a shop at AMK. Will need to do some more hunting.

It's also a good time to replace all the locks which need special force to unlock them... (the previous owner lost all the keys. >_<).

HDB Windows Maintenance Tips.

Sunday, June 22, 2008

How To: Configure VLAN-tagging on PowerConnect 5324

Here's how (to be verified):

Set the mode to trunk
switchport mode
trunk

Assign the vids you want tagged on this port
switchport trunk allowed vlan
add vid1, vid5-8 (or all)

Exclude one vid from tagging (if wish so)
switchport trunk native vlan vlan-id

Wednesday, June 18, 2008

Brewing the day...


Ah. Some nice coffee, listening to jpod101, coding homebrew...
That makes my day.

And found out the stupid Opera Mini reinstalling at startup thing. Apparently it was due to not closing the browser properly in previous session.
How suck (especially when it has to ask for connection permission on Q). Read here:

Tip: Prevent Opera Mini from re-installing on each startup

Tuesday, June 17, 2008

LibOGC - libfat

Tested file operation with libfat.

#include

// Initialise libfat
fatInitDefault();

// Open a file for reading
FILE *file = fopen("myfile.txt","wrb");

char buffer[] = {"This is a test\n"};

fwrite(buffer, 1, sizeof(buffer), file);
fclose(file);

File will be saved in the application directory (current directory) on sdcard.
So /apps/test/myfile.txt

Awesome and pretty.

Monday, June 16, 2008

Wii Homebrew - Sprite

Wanted to start creating sprites for the wii project, but found out it's not very straightforward...

tzander at tehskeen's forum wrote:
The Wii does not have a 2D graphics/sprite engine.
The trick is to draw a polygon (square) and add a texture to this polygon. It is some kind of flat object in a 3D world (think of Paper Mario) - it is not really a sprite.
Not really sure what this means without doing some real coding. Just note down first.

After some digging, it appears there are some libs (open source project) that are aimed to provide easy image manipulation (maybe...). Still evaluating which one to start with but GRR seems more promising.
1. GX Rgb Renderer Library (GRRLib) [primary lead: uschghost]
2. libwiisprite

Also found a game sprite archive but not sure how to make use of it yet. Just tag it first.

Msys (XP) - Disabling the Annoying Beep

The Msys beeps whenever the backend is hit, tab with bad name etc.

2 ways to kill the annoying MSys (The devkitpro MINGW32 console interface) beep:

1. Create the .inputrc file under you profile root (e.g. /Profiles/user/) and
set bell-style none

NB: Window Explorer doesn't allow file creation with no filename. Created .inputrc with "touch" in cmd prompt.

2. Alternatively, you may want to consider disable the Beep hardware once and for all (Who uses beep these days anyway?).
From you System control panel, open Device Manager.
From "view" menu, choose "Show Hidden Devices".
Look for "Beep" device under the "Non-plug and Play Drivers" tree list
Select "Disable"
Reboot.

Sunday, June 15, 2008

Homebew Apps - Snes9x (v3.0) by Lopst

The SNES9x emulator for Wii is pretty usable.
With WiiMote + Nunchuk support.
Install it under the Homebrew Channel load directory:
root:\apps\snes9x\

You need these 2 folders in order for snes9x to operate properly.
root:\snes9x\roms - location of the roms
root:\snes9x\saves
- location for save file creation. (Without this, you will keep getting f_open error)



WPAD Notes - Rumble

Using the rumble feature on the Wiimote is easy with the API provided by WPAD (libOGC).

WPAD_Rumble(channel, status)

channel - The id of your target wiimote. Use WPAD_CHAN_ALL to rumble all connected Wiimote.
status - 1 = turn on, 0 turn off.

Thursday, June 12, 2008

WPAD Demo with Nunchuk Code

Coded a small nunchuk reading section based on the WinterMute's WPAD demo.
However, it appears that the Nunchuk expansion has to be reseated everytime to let the application know of its existence. Even it's already connected when launching the application, the wd->exp.type is not WPAD_EXP_NUNCHUK until you unplug and plug the nunchuk again.
That's strange. Will have to check out some forum discussion to find out or maybe post question.

Going by the rate I'm getting thing done... Wont be seeing anything playable very soon.

PS: Hmmm... How do I embed code in my posting?

Here are a few sites I'm frequenting now...
http://www.tehskeen.com/forums/
http://dev-scene.com/Main_Page
http://www.nintendo-hacks.com/forums/
http://www.console-scene.info/forums/wii-homebrew-discussion/

Wednesday, June 11, 2008

Wiimote Demo Code Using WPAD

WinterMute wrote a very nice demo on WPAD API calls (including in libogc) to use the Wiimote.

A few data read on accel, ir etc are very useful for understanding the wiimote data structure.
Found missing is the expansion (nunchuck). Will try to expand the code to read nunchuck.

Monday, June 09, 2008

.dol vs .elf

Good thread about .dol vs .elf here.
Also information about using the fat lib. (sdcard access)

Quote "
dol files are the pure binary native executable format of both the Wii and the Gamecube. ELF files are the format output by the linker which contain debugging information, dol files are created from the elf files. The dol format is the preferred and recommended format for distribution.

SD card file system access is easy, all you do is link your application with libfat, call fatInitDefault() and use normal stdio functions.
LIBS := -lwiiuse -lbte -lfat -logc -lm
" End Quote.

Portion code reference:

#include
// Initialise libfat
fatInitDefault();

// Open a file for reading
FILE *file = fopen("myfile.txt","rb");

// find the size of the file
fseek(file, 0L, SEEK_END);

int size = ftell(file);

fseek(file, 0L, SEEK_SET);

// allocat buffer for file & read
void *buffer = malloc(size);
fread(buffer,1,size,file);
fclose(handle);

Compiling WiimoTetris in devkitPro 1.5

I want to write something with the wiimote and basic graphic, so start with some open source with similar property.
Wiimotetries should (hopefully) serve this objective nicely.
Actually ScummVM is much complete but the code is too complex for me at the moment.
Compilation is failed with some errors below. Clean up and update are needed.
- the sdcard.h is removed from devkitpro 1.5. The project doesn't use the sdcard so cleaning up this one should be easy.
- the wiiuse is completely rewritten for the wiimote access (now wpad). Updating this one would be a major task.

Administrator@BLOODY ~
$ cd /d/

Administrator@BLOODY /d
$ cd games/wii

Administrator@BLOODY /d/games/wii
$ cd HomebrewApps/

Administrator@BLOODY /d/games/wii/HomebrewApps
$ cd Wiimotetris

Administrator@BLOODY /d/games/wii/HomebrewApps/Wiimotetris
$ ls
Makefile Wiimotetris.elf data include source
Wiimotetris.dol build gfx readme.txt vs

Administrator@BLOODY /d/games/wii/HomebrewApps/Wiimotetris
$ make clean
clean ...

Administrator@BLOODY /d/games/wii/HomebrewApps/Wiimotetris
$ make
black.raw.bin
blue.raw.bin
candy.raw.bin
font.raw.bin
green.raw.bin
iceblue.raw.bin
mod.epidemic.mod
mod.fear.mod
mod.human.mod
orange.raw.bin
pieces.bin
red.raw.bin
tetris.mod
yellow.raw.bin
classic.c
dynamics.c
events.c
guitar_hero_3.c
io.c
io_nix.c
io_wii.c
d:/games/wii/HomebrewApps/Wiimotetris/source/io_wii.c: In function 'wiiuse_conne
ct_single':
d:/games/wii/HomebrewApps/Wiimotetris/source/io_wii.c:183: warning: implicit dec
laration of function 'bte_connect'
io_win.c
ir.c
mt.c
nunchuk.c
wiimote.c
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c:8:20: warning: sdcard.h:
No such file or directory
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c: In function 'start_wm':
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c:99: warning: implicit dec
laration of function 'bte_init'
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c:100: warning: implicit de
claration of function 'bte_start'
wiiuse.c
bg.cpp
block.cpp
blocks.cpp
globals.cpp
hitstuff.cpp
input.cpp
main.cpp
menu.cpp
removelines.cpp
reset.cpp
rotate.cpp
text.cpp
winner.cpp
linking ... Wiimotetris.elf
io_wii.o: In function `wiiuse_connect_single':
d:/games/wii/HomebrewApps/Wiimotetris/source/io_wii.c:183: undefined reference t
o `bte_connect'
d:/games/wii/HomebrewApps/Wiimotetris/source/io_wii.c:199: undefined reference t
o `bte_connect'
wiimote.o: In function `start_wm':
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c:99: undefined reference t
o `bte_init'
d:/games/wii/HomebrewApps/Wiimotetris/source/wiimote.c:100: undefined reference
to `bte_start'
collect2: ld returned 1 exit status
make[1]: *** [/d/games/wii/HomebrewApps/Wiimotetris/Wiimotetris.elf] Error 1
make: *** [build] Error 2


Administrator@BLOODY /d/games/wii/HomebrewApps/Wiimotetris
$

Sunday, June 08, 2008

Getting the Homebrew to Run on Wii

You need a way to get the Wii to run custom application.
1. Get the Twilight Hack.
This is currently the only "soft-mod" way to get you started.
No hardware mod, just a buffer overflow exploit that cause the Wii to load "boot.elf" from the SD card.

2. With the Twilight Hack, install the Homebrew Channel.

3. Once installed, the Homebrew Channel can be used to load your application from SD card without triggering the hack.
The application should be organized in this structure:
- /apps/$appsname/
- 3 files:
- boot.olf/.dol = your custom application
- icon.png = the application icon displayed on the Homebrew Channel
- meta.xml = some descriptions about the application

Read here for detail or update.

Saturday, June 07, 2008

Getting Started for Wii Homebrew Development


The first thing you need is the development tool chain: DevKitPRO

Installing this devkit (under windows) will setup all environment setting required so there is really nothing much to worry here.

After installation, open the prompt from Start/All Program/devkitpro/Msys.
Go to your devkitpro directory, try to compile the wii examples. They should be built successfully.
/c/devkitpro/examples/wii/
- template
- graphics

Once that's done, next thing is to get the project started from the template or some open source homebrew apps.

Thursday, June 05, 2008

interrupt and smp_affinity

Check your interrupt's smp_affinity

[root@localhost src]# cat /proc/irq/106/smp_affinity
7fffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff


Each bit represents 1 CPU core, there are 255 bits in the output above because the kernel is configured with max 255 CPU SMP support.

Interrupt number can be checked with

[root@localhost src]# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
0: 615812259 0 0 0 0 0 0 0 IO-APIC-edge timer
1: 3 0 0 0 0 0 0 0 IO-APIC-edge i8042
8: 1 0 0 0 0 0 0 0 IO-APIC-edge rtc
9: 0 0 0 0 0 0 0 0 IO-APIC-level acpi
12: 4 0 0 0 0 0 0 0 IO-APIC-edge i8042
14: 5505606 0 0 0 0 0 0 0 IO-APIC-edge ide0
66: 1803 0 0 0 0 0 0 0 IO-APIC-level uhci_hcd:usb1, uhci_hcd:usb3, ehci_hcd:usb5
74: 0 0 0 0 0 0 0 0 IO-APIC-level uhci_hcd:usb2, uhci_hcd:usb4
90: 408523 0 0 0 0 0 0 0 PCI-MSI eth0
98: 3 0 0 0 0 0 0 0 PCI-MSI eth1
106: 307885 0 0 0 0 0 0 0 PCI-MSI eth2
114: 128 0 0 0 0 0 0 4216539679 PCI-MSI eth3
122: 135 0 0 1727450681 0 0 0 0 PCI-MSI eth4
130: 307878 0 0 0 0 0 0 0 PCI-MSI eth5
169: 1225688 0 0 0 0 0 0 0 IO-APIC-level ioc0
NMI: 6373811 2672059 2908669 507093084 3414440 4144598 3929651 137151686
LOC: 615668730 615672280 615604333 615578017 615668454 615672006 615604038 615577637
ERR: 0
MIS: 0



Change the smp_affinity with:
echo 04 > /proc/irq/106/smp_affinity

On x86_64 system, only 1 CPU core can be tied to 1 eth interrupts. Assigning multiple cores to a single interrupt doesn't work here. The core with lowest id assigned will always be used.

iptables --set-class

Use the netfilter for classification.

iptables -t mangle -A FORWARD -m mac --mac-source 00:00:00:00:00:01 -j CLASSIFY --set-class 1:11

The --set-class only work with "mangle" table and FORWARD chain with iptables (v1.3.5).
(Tested on kernel 2.6.18, RHEL 5)

Other combinations give this stupid error message:
iptables: Unknown error 18446744073709551615

Monday, June 02, 2008

Test - Ulteo Virtual Desktop


There are numerous virtualization technologies out there. I've messed with VMware and Virtual PC before. Recently came across Ulteo Virtual Desktop and gave it a try.

Download size is ~500MB. Installation took about 1hr (might be due to too many things running on the machine.) and 5GB disk space.

The Ulteo runs flawlessly on the machine with Win XP SP2. The applications launch pretty easily without any issue. The only complaint is the launch speed (I would say pretty slow on my office machine, but hey, the machine is an aged Intel Pentium 1.73GHz with 1GB RAM - not exactly pretty). Should run smoother on a higher end machine. Might give it a try on my home machine.

Ulteo Virtual Desktop is based on the coLinux (Cooperative Linux) patch. There is another similar virtual desktop - andLinux - based also on coLinux. Have not tried out this one and think never will.

Blog from Mobile (Opera Mini)

Not good. All formatting functions are gone...

Waiting for bus.

Opera Mini 4.1 on MotoQ

Opera Mini 4.1 is the best browser for mobile device I've tried so far.

The Q comes with Opera 8.65 for Windows Mobile and Yahoo!Go. Both allow restricted web surfing (mobile mode) but not in desktop view. (Okay, the Opera for WM supports desktop mode but it's prohibitively SLOW)
The Opera Mini browser allows full page view like you would see with your desktop and it's a lot faster. (Technical detail skipped, read Opera Mini's FAQ or forum.)

Opera Mini is a Java MIDLet and install on the Java VM.
The Java VM bundled with Q (I believe it's Jblend_VM) allows you to navigate or operate the Opera Mini pretty easily but there is a problem:
- The Opera Mini for Q is unsigned (untrusted) and the browser asks you EVERYTIME you try to connect and for EVERY links you click.

There's an option:
- Install a 2nd JVM called Esmertec's JBed. (Can be downloaded from xda-developers' forum)
- Install the Opera Mini 4.1 on this JVM. (Just invoke the OM4.1 jad again after JBed is installed)

The JBed has a selector.utf file under its AppDB folder, which you could modify the domain from "untrusted" to "tckmax". This give the Opera Mini max privilege and it will never prompt you for using network connection again.

One thing though - the JBed couldn't display Chinese fonts. (There might be a way to enable it since the font is supported by WM but I'm not sure how yet.) So if you care about Chinese, you have to stick to Jblend for now.

Opera Mini: http://www.operamini.com/download/
Java MIDLet Bible: http://forum.xda-developers.com/showthread.php?t=339579&page=7