Jump to content


Photo

WVGA Teeter from HD2

- - - - -

  • Please log in to reply
86 replies to this topic

#1
Rapid81

Rapid81

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,243 posts
  • Gender:Male
  • Location:Hungary
  • Devices:Motorola Defy+
Hi everyone!

My friends Soroush0313 and Fardjad, and I want to provide you the REAL WVGA Teeter from HTC HD2.

In the last few days, we did everything to make it work, and we finally did it! The HTC HD2's WVGA Teeter is working like charm on our Omnia 2!

What we've done:
  • We patched the exe not to check the device.
  • We patched the exe to use pdraw.dll (all credits to the author(s) of this file)
  • We patched the exe to use DeviceIOControl.dll
  • In DeviceIOControl.dll we starts the SmiSensorServer_2.dll (The Samsung's sensor service) and reads the sensor's datas and pass back to Labyrinth.exe in a freaky way :(
  • And that's it!
Installation:
Copy the cab file to your device and install it. :D
Attached File  Teeter_Porting_Team_Omnia_II_Teeter.cab   2.65MB   833 downloads

Fardjad provided the source code to you all, if you want to learn some sensor's handling:
Attached File  DeviceIOControl_Source.zip   6.37KB   182 downloads
OEM Package for rommers

Additional languages (mui files) - just copy to the installation folder.Level Editors:The program's license is BSD.

Here's some screenshots from the Teeter working on my O2:
Attached File  Screen03.jpg   25.54KB   240 downloadsAttached File  Screen02.jpg   28.43KB   206 downloads

Edited by Rapid81, 28 March 2011 - 09:36 AM.

  • 1

#2
soroush0313

soroush0313

    Regular

  • Members
  • PipPip
  • 108 posts
  • Devices:HTC Sensation
reserved for future use...

Edited by soroush0313, 22 March 2011 - 09:49 PM.

  • 0

#3
Mk256

Mk256

    Diehard

  • Members
  • PipPipPipPip
  • 374 posts
  • Gender:Male
  • Devices:SAMSUNG OMNIA II
I will work on it :D
Edit:I'm getting some thing :(

Edited by Mk256, 16 March 2011 - 08:09 PM.

  • 0

#4
Mk256

Mk256

    Diehard

  • Members
  • PipPipPipPip
  • 374 posts
  • Gender:Male
  • Devices:SAMSUNG OMNIA II
I found the solution :
I just need an expert person in PE explorer for editing something in the exe file.

Edited by Mk256, 16 March 2011 - 08:42 PM.

  • 0

#5
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2

I found the solution :
I just need an expert person in PE explorer for editing something in the exe file.


Hello,
Could you please share the idea, maybe I can figure it out :D

  • 0

#6
Mk256

Mk256

    Diehard

  • Members
  • PipPipPipPip
  • 374 posts
  • Gender:Male
  • Devices:SAMSUNG OMNIA II

Hello,
Could you please share the idea, maybe I can figure it out :D

I told soroush.Ask him

  • 0

#7
Rapid81

Rapid81

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,243 posts
  • Gender:Male
  • Location:Hungary
  • Devices:Motorola Defy+
Additional informations:

Yesterday we worked on this project, but with no luck yet.

We tried to solve it from some different angles:
- Changed the service's prefix in the exe from SEN to SSS (SmiSensorServer) -> not worked
- Changed the service's prefix in the exe from SEN to ACC (Samsung's G-Sensor's device name) -> not worked
- Started the SmiSensorServer with HTCSensorservice alias -> not worked
- The HTC and the Samsung service's commands are (almost) identical. Like SEN_Init -> SSS_Init or SEN_Read -> SSS_Read.

We came up with a possible solution, but we definitely need some help in this.

The idea is the following:
- We need a WM service dll, what's pretend itself as HTCSensorService (Prefix: SEN, dll's name: HTCSensorService.dll)
- This service captures the requests from the Labyrinth.exe
- Redirects the requests to the Smi Sensor Server (Prefix: SSS, dll's name SmiSensorServer_2.dll) or to the SamsungMobilesdk_2.dll
- Then pass back the values of the G-Sensor's readings to the Labyrinth.exe

I tried to contact with Chainfire, but he didn't respond (yet?). Ginkage was not here seen since last september. :(

I know we have programming experts here, and I hope they can help us. :D

  • 0

#8
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2
Mar 18 2010:

Before we making HTCSensorService.dll compatibility layer, I decided to look into the Labyrinth.exe carefully,
I've disassembled two functions: HTCSensorOpen and InitSensorEvents (the function names are abstract).

Here is the result:

HANDLE HTCSensorOpen(int sensorType)
{
  hDevice = CreateFileW("SEN0:", 0, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  
  if (hDevice == INVALID_HANDLE_VALUE) {
	  if(!RegisterService("SEN", 0, "HTCSensorService.dll", 1)) return NULL;
  
	  hDevice = CreateFileW("SEN0:", 0, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
	  if (hDevice == INVALID_HANDLE_VALUE) return NULL;
  }
  LPDWORD lpInBuffer = new DWORD;
  CONTROL_CODE = 0x1000001 // Related to SENSORTYPE_GSENSOR;
  if (!DeviceIoControl(hDevice, CONTROL_CODE, &lpInBuffer, sizeof(DWORD), &lpOutBuffer, 0, &lpBytesReturned, NULL));
	  KDbgPrintfW("[AP:SensorSDK] Can't update. Used default setting");
  }
  if (!InitSensorEvents(hDevice)) return NULL;
  return hDevice;
}

bool InitSensorEvents(HANDLE hDevice)
{
  HANDLE hEvent = CreateEvent(NULL, 0, 0, "HTC_GSENSOR_SERVICESTART");

  if (hEvent == NULL) return 0;

  EventModify(hEvent, EVENT_SET);

  Sleep(100);

  hEvent = CreateEvent(NULL, 0, 0, "HTC_GSENSOR_SERVICESTOP");

  if (hEvent != NULL) return 1;

  CloseHandle(hDevice);

  return 0;
}

I realized that if we want to make Labyrinth use Samsung Service, we should do the following:
  • Change SEN0 to ACC1
  • Change SEN to SSS(?)
  • Change the CONTROL_CODE:
    Samsung control codes are:
    ACCOnRot = 0x44E
    ACCOffRot = 0x44F
    ACCReadValues = 0x80122EF0 I think we only need this one
Also the output of Samsung Service and HTC Service is completely different:
Samsung outputs {3*16 bits} (X, Y, -Z) but HTC outputs {3*16 bits, 16 bit, 3*32 bits} which we need first three 16 bits as (X, Y, Z).
Another difference is the readings offsets. (2048 for Samsung)

I think we can solve all these problems by redirecting (import table patching) DeviceIOControl function in Labyrinth.exe
We should make a dll with DeviceIOControl function implemented in it, redirect the requests to Samsung Sensor, adapt it's output and... we'll done.

Obviously we can do this faster if others help us.

Best Regards.

Edited by fardjad, 22 March 2011 - 10:07 PM.

  • 0

#9
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2
Patch Mar 20 2011:

In this version I've Patched Labyrinth.exe import table to redirect these functions:
  • DeviceIoControl: To change the IO Control Code to 0x80122EF0 and the Sensor Device Name to ACC1:
  • RegisterService: To make Labyrinth use SmiSensorServer_2.dll and register the service as SSS
Someone please test this version and report. (I don't have Omnia II anymore).

I'll attach the redirector functions source-code for those who want to contribute :D

Edit:
The working source-code and Teeter package can be found in post #1.

Edited by fardjad, 22 March 2011 - 10:10 PM.

  • 0

#10
Rapid81

Rapid81

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,243 posts
  • Gender:Male
  • Location:Hungary
  • Devices:Motorola Defy+

Patch Mar 20 2011:

In this version I've Patched Labyrinth.exe import table to redirect these functions:

  • DeviceIoControl: To change the IO Control Code to 0x80122EF0 and the Sensor Device Name to ACC1:
  • RegisterService: To make Labyrinth use SmiSensorServer_2.dll and register the service as SSS
Someone please test this version and report. (I don't have Omnia II anymore).



I'll attach the redirector functions source-code for those who want to contribute :D


Tried, but unfortunately, it's not working. But something definitely changed. With the first version, when I put the Teeter to the background, then resumed, the ball went from the upper left corner, to the bottom right and stays there. Now, after the resume, the ball moves a little, about 2 millimeter, and stops. The SMI Sensor Server service is running on my phone. Do I need to stop it or delete from the services?

Update:
This is interesting. When I unplug the phone from the USB, the ball moves away from the wall about a centimeter, then goes back. When I replug the USB, the ball does the same. It does the same with removed, running or stopped SMI Sensor Server service.

Edited by Rapid81, 20 March 2011 - 11:02 PM.

  • 0

#11
soroush0313

soroush0313

    Regular

  • Members
  • PipPip
  • 108 posts
  • Devices:HTC Sensation
Hello Everyone
Finally we are done, I confirm that I8000 Teeter works fine

every thing's just working fine

We are going to clean every thing up and release a new full cab very soon ... :D

Edited by soroush0313, 22 March 2011 - 05:30 PM.

  • 0

#12
HAL_9000

HAL_9000

    Enthusiast

  • Members
  • PipPipPip
  • 153 posts
  • Gender:Male
  • Location:Ulaanbaatar
  • Devices:LG Optimus 2X
That´s great! :D
I look forward to new release...

  • 0
Posted Image

#13
Rapid81

Rapid81

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,243 posts
  • Gender:Male
  • Location:Hungary
  • Devices:Motorola Defy+
Check the first post. :D

Edited by Rapid81, 22 March 2011 - 09:55 PM.

  • 0

#14
BTGDelta

BTGDelta

    Newbie

  • Members
  • Pip
  • 6 posts
complains about unvalid certificate... help a wm 6.5 newbie pls

  • 0

#15
thund3r

thund3r

    Regular

  • Members
  • PipPip
  • 63 posts

complains about unvalid certificate... help a wm 6.5 newbie pls


Same here... the exe is not working properly and it installs directly into the Windows folder!
Get's messy...

Edited by thund3r, 23 March 2011 - 01:43 AM.

  • 0

#16
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2

Same here... the exe is not working properly and it installs directly into the Windows folder!
Get's messy...


It needs to be installed in Windows folder for a reason :D

  • 0

#17
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2

complains about unvalid certificate... help a wm 6.5 newbie pls


That error message usually means the application can't find its dependencies. (Post your ROM information).

Edited by fardjad, 23 March 2011 - 05:10 AM.

  • 0

#18
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2
I've attached a new cab. Installs faster and performs full cleanup on deinstallation :D

Edit:
See the first post.

Edited by fardjad, 23 March 2011 - 05:50 AM.

  • 0

#19
Odysseas07

Odysseas07

    Enthusiast

  • Members
  • PipPipPip
  • 201 posts
  • Location:Athens
  • Devices:Omnia2
Hello

Just install it but i have a problem

When i install it it install only an zip file on windows directory...

I have to find it and extract it where i want and then i can play the game

i dont know if you undrestand me .....

and 1 more thing

when i play and touch the screen i can see 2 empty buttons. How we can see the words on it ???

Edited by Odysseas07, 23 March 2011 - 06:36 AM.

  • 0

#20
fardjad

fardjad

    Newbie

  • Members
  • Pip
  • 26 posts
  • Interests:Windows Mobile Development and Hacking.
  • Devices:HTC HD2

Hello
Just install it but i have a problem
When i install it it install only an zip file on windows directory...
I have to find it and extract it where i want and then i can play the game
i dont know if you undrestand me .....


It supposed to extract contents of the zip file to your Windows directory. Did you installed the previous version before? And did you see the message: "Omnia II Teeter 0.4.4.0 by Teeter Porrting Team" after installation?

and 1 more thing
when i play and touch the screen i can see 2 empty buttons. How we can see the words on it ???


The files should be placed in Windows folder for the application to work correctly.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users