Emuforums.com

Go Back   Emuforums.com > PS2 Emulation > PS2 Plugin Questions & Plugin Troubleshooting
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

Reply
 
Thread Tools Display Modes
Old August 14th, 2008, 21:35   #1
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
Talking MegaDev9 plugin !!!

Hi,

I've written a DEV9 plugin that emulates HDD.

DEV9 is a part of the PS2 that handles USB, HDD and Ethernet.
In PCSX2, USB is handled by a USB plugin, HDD and Ethernet are handled by a DEV9 plugin.

READ THE INSTRUCTIONS BELOW BEFORE POSTING!!!
I will NOT answer any question which is already answered here. So I advise you take some
time and read the instructions below.

To get the plugin working:

1- Put MegaDev9.dll in the plugins folder of PCSX2 (NOT THE ROOT FOLDER), otherwise it won't
show up in the plugins list. The plugin doesn't require any external DLL to work. (that may change in the future, namely, WinPcap
comes to mind when talking about ethernet support)

2- Make sure you've a DEV9-capable PS2 BIOS. Slim PS2 BIOSes aren't compatible (Thanks to
Suloku for this info), and BIOSes from old PS2s with PCMCIA aren't too (afaik). You must also
have the EROM, ROM1 and ROM2 files with your BIOS. In other words, you must have a
complete BIOS dump from your PS2. Don't complain that the plugin doesn't work if you're
using a downloaded (illegal) BIOS. (DEV9-capable BIOSes are SCPH-3XXXX and SCPH-5XXXX).


3- Configure the plugin. For that you must launch PCSX2, select MegaDev9 in the DEV9 plugins
list and click on the Configure button. A GUI will show up, here's its description :
-Enable logging : this is only for debugging purposes. The plugin will write all events
to a file.
-HDD file : enter the path and the name of the HDD image (see below for more info about
HDD image). If you leave it, the image will be created in the PCSX2 root folder.
-HDD size : select the size you want for the emulated HDD (HDD image). You can choose
from 1 GB to 127 GBs. I recommend selecting at least 8 GBs, lower sizes could cause problems.

4- Launch your game/program in PCSX2. The first time, the HDD image will be created in the path that you
previously configured. This may take more or less time depending on the HDD size you've selected. Wait until
the progress bar gets complete (100%). Then your program will ask for formatting if it's able to do this. If
you followed the previous steps right, your program won't ask for formatting anymore, nor other
programs will do.

The HDD image is a file that will be used as a HDD, ie. when your program writes data in the
HDD, the plugin will write these data in this file. Don't delete or move it without
reconfiguring the HDD file path in the plugin, or you may cause problems.



Troubleshooting
Note : if your problem persists or if it's not described here, tell me. Attach a log file
if possible.

When I run HDLoader, I get a black screen.
If you're using GSDX, enable "Logarithmic Z" in its options (Thanks to tich). If you're using speed hacks, disable them.

My program always asks for formatting.
If you've this problem, make sure you've a complete BIOS dump from a DEV9-capable PS2. The
first models with PCMCIA aren't DEV9-capable, and the slim PS2s aren't too. Make sure the
console doesn't tell it couldn't find rom1, rom2 or erom, these files are needed.

My program fails writing to the HDD.
Make sure you've enough space on your real HDD and also that the HDD image is big enough. Make
sure the HDD image doesn't have read-only attribute.

When I use savestates, I've problems with HDD funcs in my program.
That's normal, savestates aren't supported yet.

When I use the HDD command X, it doesn't work, it reports an error.
The command you're trying to use isn't implemented, or you're passing invalid args.

How can I copy games with HDLoader ?
First, be sure to use at least PCSX2 0.9.6. Older versions have a CDVD timing bug which prevents HDLoader to work correctly.
You need to insert your game DVD in your drive (or opening the ISO if you're using an ISO CDVD plugin), and open the HDLoader
ELF file. This way, you should be able to copy your games smoothly. Pretty hacky, I know, but for the moment no CDVD plugin supports DVD hot swapping.
Anyway, keep this in mind: YOU CAN'T BOOT THE GAMES YOU COPIED IN THE HDD !!! Because of a bug I haven't found yet.



I need help !
If you can find me documents about the DEV9 device, you're highly welcome !
ATM, my only document for that ****ing device is the sources of PS2SDK. They actually helped me a lot as HDLoader uses
the same DEV9 code as PS2SDK !

Note:
I designed the plugin to be as many portable as possible. The only Win32-only thing is the GUI.
If somebody is interested in porting the plugin for Linux, he's free to do it. Isolate all the
Win32-specific code with #ifdef / #endif tags.

Changelog:

Version 1.0.0
-First version, support for HDD emulation.

Version 1.0.1
-Reduced the IRQ timings
-The minimal HDD size is now 8 GBs, lower sizes seem to cause problems
-Implemented the Idle command
-Implemented the nIen bit in control reg (disables IRQ)
-Fixed a bug occuring when pressing Escape then running another HDD-compliant program in PCSX2
-Implemented the Sony-specific security control command (0x8E), the programs that want a Sony HDD should now work without a patch
-Changed a bit the Identify device command, maybe it will fix Final Fantasy XII.

Download the plugin and its sources in the attachments.

Compatibility of the HDD image:
The HDD image can be mounted with Mount Image Pro or any other image mounter. After you mounted the image, you can use it with HD Handiness (see SKSApps). WinHIIP says that HDL file settings is corrupt, I don't know why, maybe this is because I used an image of 8 GBs. Simply click OK and you'll be able to use it without corrupting your HDD image. Make sure you unmount the image before launching PCSX2, otherwise the plugin won't success to open the HDD image.

What you must know about the Sony HDD:
The Sony HDD is a standard HDD, but its firmware has been modified by Sony in order to support a command that standard HDDs don't support. Sending this command to the HDD is the only way to distinguish if the HDD is Sony or not, if it reports an error, then it's not a Sony HDD. This command is implemented in version 1.0.1 and later, so Sony programs will work with it. This command is "SCE security control" (0x8E).

What is planned for next versions:
- More intelligent HDD image format (automatic compression of zero-filled blocks + LZ77 compression) (will be incompatible with WinHiip )
- Better implementation of SCE security command
- Better IRQ handling and such
- 48-bit support (no more 127 GBs limit, if you've a big HDD)
- EEPROM emulation
- The long-awaited Ethernet emulation

Credits to :
- Authors of PS2SDK and DEV9Linuz, without these source codes I couldn't have figured out how DEV9 works.
- Authors of various documents explaining how PC IDE controllers work.
- Suloku for pointing out the compatibility problems with slim PS2 BIOSes.
- KabooZ for the infos about the Sony HDD.
- MiKE41 for his great help (testing).
- tich for how to fix the black screen bug with HDLoader.
- kamilusPL for his help.
Attached Files
File Type: zip MegaDev9_1.0.1.zip (73.4 KB, 8084 views)
File Type: zip MegaDev9_1.0.0.zip (72.9 KB, 3434 views)
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.

Last edited by Luigi__; August 29th, 2009 at 23:28.. Reason: Update; version 2.0.0 is likely to come soon
Luigi__ is offline   Reply With Quote

Advertisement [Remove Advertisement]

Old August 14th, 2008, 21:42   #2
Hard core Rikki
Moving into the beat
 
Hard core Rikki's Avatar
 
Join Date: May 2004
Location: Perpetual Hawaii
Posts: 11,387
ONe more sticky, one.
Nice job working that one out, btw
__________________

Hard core Rikki is online now   Reply With Quote

Old August 14th, 2008, 21:49   #3
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
Thanks.

BTW, I think you'll agree with me, there're many stickies.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 14th, 2008, 21:57   #4
rama2
Emu author
 
Join Date: Sep 2007
Location: Germany
Posts: 1,467
Many thanks for this!
However I can't get hdloader to recognize my ps2 disc, any idea on how to get games on the hdd?
rama2 is offline   Reply With Quote

Old August 14th, 2008, 22:19   #5
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
What version are you using ?
Mine is 0.8c.

Are you talking about HDD or DVD ?
If it's DVD it's normal. The current CDVD plugins don't (or badly) support changing disc on the fly.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 14th, 2008, 22:38   #6
rama2
Emu author
 
Join Date: Sep 2007
Location: Germany
Posts: 1,467
Well, i tried just every possible combination of many cdvd plugins and their settings.
Running hdloader 0.8c directly from .elf. So i dont need to change discs or smth.
Whenever i tell hdloader to install games, the software gets the disc status, then hangs
rama2 is offline   Reply With Quote

Old August 14th, 2008, 22:44   #7
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
That's normal for the moment. I also tried every tricks that I found to get it copying a game, resulting in either a message saying "the disc inserted is not a valid PS2 disc" or hanging after HDLoader has read some sectors from DVD.

EDIT : Keep in mind that HDLoader isn't the only application for this plugin. PS2Linux may also work, and I read somewhere that Final Fantasy XI needs a HDD to work (not tested, I don't have this game). And now PS2 homebrewers can test their HDD homebrews directly on PCSX2, without needing to send them to their PS2 at each test.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.

Last edited by Luigi__; August 14th, 2008 at 22:48.. Reason: Automerged Doublepost
Luigi__ is offline   Reply With Quote

Old August 15th, 2008, 11:33   #8
bositman
Angel of Death
 
bositman's Avatar
 
Join Date: Jun 2002
Location: Athens, Greece
Posts: 3,629
Quote:
Originally Posted by NHervé View Post
That's normal for the moment. I also tried every tricks that I found to get it copying a game, resulting in either a message saying "the disc inserted is not a valid PS2 disc" or hanging after HDLoader has read some sectors from DVD.

EDIT : Keep in mind that HDLoader isn't the only application for this plugin. PS2Linux may also work, and I read somewhere that Final Fantasy XI needs a HDD to work (not tested, I don't have this game). And now PS2 homebrewers can test their HDD homebrews directly on PCSX2, without needing to send them to their PS2 at each test.
Seems rama made some timing fixes allowing games to install now,without that hang there Although they crash before playing

Possible bug: Even if i chose to make an 8GB image,i ended up with a 4.067.329kb raw file...the partition i'm doing this is NTFS before you ask
__________________
bositman is offline   Reply With Quote

Old August 14th, 2008, 23:02   #9
rama2
Emu author
 
Join Date: Sep 2007
Location: Germany
Posts: 1,467
Yeah, sure it has lots of other uses
But i wanted hdloader especially, since i wanna try and work around a cdvd timing issue.

So still, great work, and lets see if the PS2 Linux works
rama2 is offline   Reply With Quote

Old August 14th, 2008, 23:09   #10
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
If you can code, you're free to create a CDVD plugin that supports changing disc on the fly, this will be appreciated However, GiGaHerz is working on that with his CDVD plugin.

If you can test PS2Linux, then go test it. I'll appreciate that.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 15th, 2008, 02:55   #11
Silenus
Pilgrim
 
Join Date: Apr 2005
Location: Hyperion
Posts: 6,968
Appreciate the work you are doing with your plugins NHervé.

Thanks a lot.
__________________
DELL XPS 13 ULTRABOOK

...Mis sueńos son mentiras que algun día dejarán de serlo...
Silenus is offline   Reply With Quote

Old August 15th, 2008, 08:39   #12
bositman
Angel of Death
 
bositman's Avatar
 
Join Date: Jun 2002
Location: Athens, Greece
Posts: 3,629
Great job NHervé! Hope you keep working on it until it's perfect Added the news in the PCSX2 site
__________________
bositman is offline   Reply With Quote

Old August 15th, 2008, 10:38   #13
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
Thanks a lot !
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 15th, 2008, 10:53   #14
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
aaaaaaaaaaand stickied
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
refraction is offline   Reply With Quote

Old August 15th, 2008, 12:27   #15
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
refraction : thanks a lot !

bositman : if rama is working on HDLoader issue, that's great. For your image size issue, that's normal, when the image is created, it's empty, ie. its size is 0 byte. If your program only writes 4 GBs of data, the image will have a size of 4 GBs. BTW, what's your program ? It can't be HDLoader, because HDLoader creates APA parititons.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 15th, 2008, 14:41   #16
bositman
Angel of Death
 
bositman's Avatar
 
Join Date: Jun 2002
Location: Athens, Greece
Posts: 3,629
Quote:
Originally Posted by NHervé View Post
refraction : thanks a lot !

bositman : if rama is working on HDLoader issue, that's great. For your image size issue, that's normal, when the image is created, it's empty, ie. its size is 0 byte. If your program only writes 4 GBs of data, the image will have a size of 4 GBs. BTW, what's your program ? It can't be HDLoader, because HDLoader creates APA parititons.
Well with his modifications,now it doesn't hang at recognizing the disc Check your PM for the build,I bet it will help you improve your plugin alot
I'm using HDloader I just said my HD is NTFS not the image
__________________
bositman is offline   Reply With Quote

Old August 15th, 2008, 12:59   #17
MiKE41
Title goes where?!
 
MiKE41's Avatar
 
Join Date: Sep 2004
Location: Canada
Posts: 112
I also noticed that no matter what file I select it comes out with a 4gb file (making it on a NTFS partition too)

Things I tried:

Taking a raw image (made with dd) of a PS2 hard drive, feeding it to MegaDev9. Result: frozen at the HDL splash screen.

Mounting a hard drive image (made with MegaDev9 + PCSX2) using Mount Image Pro (Computer Forensics Software Download: Download Mount Image Pro) then loading it up with WinHiip to put a game on. Result: WinHiip complained about something (I have no idea what to make of it), and was too small to format correctly. WinHiip noticed the drive as 4gb even though I selected 11gb in the MegaDev9, and the HDL menu said 11gb options.


Note with MountImagePro: After you tell it to mount the drive, it will continue to say theres no drives mounted, however it shows up in WinHiip just fine.

Edit: It seems that hddImage = fopen(config.hddFile, "r+b"); is whats causing the file to be limited to 4gb after a quick google (fopen 4gb - Google Search)
Attached Images
File Type: png FreeSpace.PNG (227.5 KB, 233 views)
File Type: png MemError.PNG (227.1 KB, 146 views)

Last edited by bositman; August 15th, 2008 at 14:40.. Reason: Made images as attachments
MiKE41 is offline   Reply With Quote

Old August 15th, 2008, 14:06   #18
Luigi__
Formerly NHervé
 
Luigi__'s Avatar
 
Join Date: Jul 2007
Location: Peach__'s castle
Posts: 818
That's normal for the moment. The image isn't zero-filled at start. I had implemented this feature before, but I've removed it because zero-filling the image took too many time.
__________________
Luigi__'s website - now open! -- If you're wondering where Mario__ is, he is currently saving Peach__ once again.
Luigi__ is offline   Reply With Quote

Old August 15th, 2008, 15:48   #19
rama2
Emu author
 
Join Date: Sep 2007
Location: Germany
Posts: 1,467
In cdvdReadTimeRcnt in cdvd.c:

//simulates spin-up time, fixes hdloader
if (cdvd.Sector < 17) cdvdReadTime=60000;
rama2 is offline   Reply With Quote

Old August 15th, 2008, 18:48   #20
radical dreamer
n00b necromancer
 
radical dreamer's Avatar
 
Join Date: Sep 2003
Location: California, USA
Posts: 28
Final Fantasy XI.. Well it runs now, but says of course, that PlayOnline needs to be installed before using FFXI, and PlayOnline doesn't run on the current public beta pcsx2.

What I get with PlayOnline installer in pcsx2:
CdRead: Reading Sector 16
CdRead: Reading Sector 257
SKIP level changed to: #
SKIP level changed to: #
SKIP level changed to: #
SKIP level changed to: #
SKIP level changed to: #
etc.

Also I couldn't get the PS2 Utility disc 1.10 to run in the emu to test that, it just crashes it.
__________________
radical dreamer is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 07:41.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.