2009年11月19日 星期四

上實機了 iPhone 3GS ^^

下方是玩家控制黃棒, 上方是電腦控制青棒, 中間有一個 RGB 方塊會碰到邊界或棒子會反彈.

不過實際玩起來竟發現一件小插曲...

只有我以黃棒為主觀的控制. 也就是 iPhone 右翻時(螢幕面先水平朝天空, 再轉往朝右), 黃棒是向左移(有點像水平儀的泡泡一樣, 因傾斜浮起來), iPhone 左翻時, 黃棒向右移.

我一直覺得很習慣. 給朋友 Shark 看, 他開始玩時, 竟說我左右翻的操作做錯了方向了. 我說哪有!!

就給他老婆 Benjo 測, 也是拐了拐打不到球, 想一想, 他們應該是以方塊為主體, 方塊移右邊, 就隨他方向, 操作螢幕翻右邊, 反之方塊移左邊, 就操作螢幕翻左邊 . 或是以為黃棒是重物, 翻轉(傾斜)使他下沈...

回家不太相信只有自己是這樣, 給老婆試, 她也是也是那樣操作...所以很難打到方塊 Haha 心想如果這樣逆向當困難度的遊戲也不錯阿!

以前飛行模擬遊戲的搖桿也是有這樣的問題, 有的第一次接觸的玩家會把搖桿往上(前)移動, 以為飛機會往上飛, 但實際飛機是往下飛的, 所以遊戲裡常有做兩種操作方式的切換 (p.s. 真的飛機不會這樣做兩套吧)

2009年11月18日 星期三

C/C++ 函示指標的使用

這是我找到(已知)最好 C/C++ 函示指標使用的教學網站

The Function Pointer Tutorials

函示指標的技巧我滿愛用的, 但語法規則常常忘記, 每次修正好後, 一段時間之後再寫新的, 又報 compile 錯誤, 人老了, 寫 20 幾年的 C 了, 這個總是要再查一下他的範例寫法 :_

恩...需要找時間把這網站的資料下載一下免得他倒了.

How to Implement a Callback to a non-static C++ Member Function ?

單這個就打死 90% 的 C/C++ 程式設計師了吧 ^^

2009年11月11日 星期三

不止 Hello World


如果只是秀一個 Hello World 很遜, 上面畫面是我試寫的一個小 APP, 直接在我的 PC 上跑 XP 上跑 VMWare 上跑 iATKOS 上執行 XCode + iPhone SDK 上跑 iPhone 模擬器 (好繞 ^^).... 成功 PING PONG! (向 Atari 的第一支遊戲致敬, 1975 年 by Al Alcorn)

這 App 測試了幾個基本東西:
1. OpenGL 2D 精確畫圖
2. Touch 移動
3. 三軸加速感應

其實我有一台老 iBook G4 透過 "技巧" 也可以安裝 iPhone SDK (官方 iPhone SDK 只能在 Apple 的 i386 機器上安裝), 但在 PC 上開發對我來更能駕輕就熟阿!

這種開 VMware 模擬雙平台方式開發, 對我來說不是第一次, 以前作其他嵌入式系統也有這樣, 在 PC 上用熟悉的工具, 撰寫程式碼, 然後在 VMWare + Linux 或控制遠端機器讀取這些程式碼(共享)來編譯!

如果沒有從事跨平台程式的寫作人可能無法領會. 有機會碰到就知道了.

2009年11月3日 星期二

A detail steps to insatll iATKOS v7 in VMware Workstation v6.5.3

My PC is Intel Core2 6400 w/ 2GB RAM
I think the other H/W are not important for VMware because it always simulate them as generic devices

Host OS is Windows XP SP3 w/ last patches (11.1.2009)

as the MD5 for the ISO image of 'iATKOS v7 DVD 10.5.7.for Intel.AMD' I got is 6395be5253f53f716ed042db1dd599f3
don't need to burn it to a phsical DVD

Following are after my many test and also thanks to those forerunners provided their experiences in internet...


A) Setup a new virtual machine
=====================================================
1. What type of configuration do you want?
select 'Custom (advance)
click 'Next'
2. Hardware compatibility:
select 'Workstation 6.5'
click 'Next'
3. Install from:
select 'Installer disc image file'
browse or enter your iso path like
'D:\OSX86\iATKOS_v7.iso'
click 'Next'
4. Guest operating system:
select 'Other'
Version:
select 'FreeBSD 64-bit'
click 'Next'
5. Virtual machine name:
enter any name you like as my case
'iATKOS v7'
Location:
browse or enter a folder name which has enough
space as my
case
'E:\My Virtual Machines\iATKOS_v7'
click 'Next'
6. Numer of processors:
select any you like as my case
'One'
click 'Next'
7. Memory for this virtual machine:
pull to or enter '1024' MB or depand on you like
click 'Next'
8. Network connection:
select 'Use netwtok address translation'
click 'Next'
8. I/O adapter types:
select 'LSI Logic'
click 'Next'
9. Disk:
select 'Create a new virtual disk'
click 'Next'
10. Virtual disk type:
select 'SCSI'
click 'Next'
11. Maximun disk size:
enter any number > 8 G as my case '20' GB
select 'Store virtual disk as a signle file' or
any you like
click 'Next'
12. Disk File:
use default name or any you like
click 'Next'
13. in last Ready to create VM screen
select 'Power on this virtual machine after
creation'
click 'Finish'

B) Before MacOS install
=====================================================
1. when in Drawin/x86 booting...
click mouse on the booting screen to let vm has
input focuse
2. When see press any key bla bla...
press 'F8' key to enter the startup options
3. after boot: prompt
enter 'busratio=20'

NOTE: this is very important and tricky some said
need to add -v like
busratio=20 -v
or
busratio=20 cpus=1 -v
...
4. after wheeling
a) if it just reboot again
goto 3 try another options (sorry i can't help
you)
b) if it is lucky to see apple GUI dialog screen
click the button to continue
5. in iATKOS v7 welcome screen
click 'Continue'
6. in license aggrement screen
click 'Agree'
7. in select a destination screen
you need to create a partition first
in the top menu click 'Utilities' -> select 'Disk
Utility'
-----------------------------------------------------
8. in the left list select '20 GB VMware...'
in the right multi-tabs click 'Partition' tab
9. in the Partition group
Volumn Scheme:
select '1 Partition' or other you like
Name:
any name you like
Format:
select 'Mac OS extended (journaled)'
'Install Mac 9 Disk Drivers' is selected in my
case
click 'Option...' button below
10. in Chose a partition scheme bla bla...
select 'Master Boot Record'
NOTE: the default scheme will cause later
installation failure
click 'OK' to close this window
11. now click 'Apply' button below
12. in Partition Disk dialog
Are you sure bla bla...
click 'Partition' botton!
13. if in the left list below '20 GB VMware...' has
new hardisk(s) appeared
close this window
-----------------------------------------------------
14. it should has a hardisk icon appeared
select it
click 'Continue'
15. click 'customize' will pop a new window
16. select 'Restore Defaults' button first
beside the default options, add following to
be selected
'X86 Patches'->'Kernel'->'9.5.0 Kernel voodoo'
NOTE: otherwise you will get endless
reboot after step C.2
'Drivers'->'PS/2 mouse/keyboard'->Voodoo PS/2
driver
NOTE: otherwise MacOS can't identify the
keyboard/mouse after startup
and other options if you know what them are
'Drivers'->'NTFS-3G'
NOTE: 1. so you can WRTIE the USB or
removable drive w/ NTFS format
2. may cause undeleted files
(.DS_Store .Trashes ..) in drive
'Langusages'->any you like
press 'done' to close the window
17. click 'Install'
18. you can skip the installation DVD checking
19. see a blue progress bar going and wait wait wait

C) After MacOS install
=====================================================
1. when finished and after first reboot you see a
green cameleon in the top below an apple and a
blue bar is counting down to startup and said
'Press any key to enter startup options...'
do it!
2. it will stop couting down
press any key (but not 'Enter' key) to enter the
options 'busratio=20' again
or
busratio=20 cpus=1 -v
or
busratio=20 -f -v
...
then press 'Enter' key
3. after wheeling
a) if it just reboot again
goto step C.2 try other options (sorry i can't
help you)
or
reinstall from A.1 and pick another options in
step B.16
b) if it is lucky to see apple GUI dialog screen
click the button to continue
5. just by the instructrions to setup your user
account

D) After MacOS setup
=====================================================
1. After you setup your user account
2. find Terminal.app ins
Finder->Applications->Utilities
3. open up terminal and type
'sudo nano /Library/Preferences/SystemConfigurati
on/com.apple.Boot.plist'
then enter your password
4. where it says
Kernel Flags

put busratio=20 between the and
like this 'busratio=20'
then save the file by Ctrl-O
so you can skip C.2 when next reboot
NOTE: some times it still freezed in cameleon
counting down screen then just repeat
the trick as step C.2 or reset VM
MEMO: 1. it is recommanded to use vmware
suspend function when close vmware ^^
2. maybe need to install other 'X86
Patches'?
close Terminal.app
5. find System Preferences.app in
Finder->Applications->System Preferences
adjust the machine sleep setting
Hardware / Energy Saver
'Put the computer to sleep bla bla...'
->Never
'Put the display to sleep bla bla...'
->Never
to avoid dead sleep after long time idle
6. all is done
now you can examine the MacOS as u wish...

NOTE: it seems no sound for Voodoo HDA driver was
failed but multimedia is not my purpose so
I don't care of it