PDA

View Full Version : Cemu 1.34 1.94 Module_1 030609


Scoobydooo
03-07-2009, 07:35 AM
Many thanks to mpc30 @ ET for this current fix, and thanks to all Cemu coders who keep Cemu alive! :)



// module 1 for NA (20080502ry v35)
#define mmB(_p1,numb) \
{ \
BN_zero(s); \
for(int i=0; i<((numb+7)>>3); i++) { \
BN_rshift(x,_p1,i<<6); \
BN_mask_bits(x,64); \
BN_mul(x,x,B,ctx); \
BN_add(s,s,x); \
BN_copy(x,s); \
BN_mask_bits(x,64); \
BN_mul(x,x,J,ctx); \
BN_lshift(C,x,64); \
BN_add(C,C,x); \
BN_rshift(C,C,2); \
BN_add(C,C,s); \
BN_rshift(C,C,52); \
BN_mask_bits(C,12); \
BN_mask_bits(x,64); \
BN_mul(x,x,D,ctx); \
BN_add(s,s,x); \
BN_lshift(y,s,12); \
BN_add(C,C,y); \
BN_mask_bits(C,128); \
BN_rshift(s,s,64); \
BN_copy(Z,s); \
if(BN_cmp(s,D)==1) BN_sub(s,s,D); \
} \
BN_copy(B,s); \
}
// --------------------------------------------------------------------------------------------------
{
BIGNUM *A=BN_new(); BIGNUM *B=BN_new(); BIGNUM *C=BN_new(); BIGNUM *D=BN_new(); BIGNUM *DAT=BN_new();
BIGNUM *J=BN_new(); BIGNUM *Z=BN_new(); BIGNUM *v=BN_new(); BN_CTX *ctx=BN_CTX_new();
BIGNUM *s=BN_new(); BIGNUM *x=BN_new(); BIGNUM *y=BN_new();
unsigned char *_a=hw,*_b=&hw[0x10],*_c=&hw[0x20],*_d=&hw[0x30],*_j=&hw[0x40],*_4445=&hw[0x50],*_z=hw;
unsigned int m=0x27+0x72+(A00[4]&0x3F)-0x79;
unsigned char xr=((A00[2]-1)&3)+0x0A;
A00[0]|=A00[9];
memset(hw,0,sizeof(hw));
memcpy(hw,A00,0x05);
ExpandInput(hw);
RotateBytes(_a,0x10); BN_bin2bn(_a,0x10,A); RotateBytes(_a,0x10);
RotateBytes(_b,0x10); BN_bin2bn(_b,0x10,B);
RotateBytes(_c,0x10); BN_bin2bn(_c,0x10,C);
RotateBytes(_d,0x10); BN_bin2bn(_d,0x10,D);
RotateBytes(_j,0x08); BN_bin2bn(_j,0x08,J);
RotateBytes(_4445,0x10); BN_bin2bn(_4445,0x10,DAT);
int ti=0;
int tx=0;

// printf("0x%4.4X\n",((m<<8)|A00[3]));
switch ((m<<8)|A00[3]) {
case 0x3963:
case 0x3967:
case 0x3B41:
case 0x3B7B:
case 0x3B7F:
BN_rshift(Z,C,64);
BN_lshift(Z,Z,64);
memset(_z,0,0x10);
break;
case 0x3986:
case 0x3A58:
case 0x3E68:
case 0x3B6A:
case 0x3B89:
case 0x3E8C:
BN_zero(v);
BN_set_bit(v,((m==0x3B)?128:136));
BN_mod(Z,v,D,ctx);
memset(_z,0,0x10);
break;
case 0x2100 ... 0x21FF:
case 0x39B0:
case 0x3BB0:
case 0x3EAE:
BN_zero(v);
BN_sub(J,v,D);
BN_set_bit(J,0);
BN_set_bit(v,64);
BN_mod_inverse(J,J,v,ctx);
BN_mask_bits(J,64);
BN_mod(D,D,v,ctx);
BN_mul(C,J,D,ctx);
BN_rshift(C,C,64);
BN_mask_bits(C,64);
BN_copy(Z,C);
memset(_z,0,8);
break;
case 0x25AB:
BN_zero(v);
BN_sub(B,v,D);
BN_set_bit(B,0);
BN_set_bit(v,128);
BN_mod_inverse(B,B,v,ctx);
BN_mask_bits(B,128);
BN_mod(D,D,v,ctx);
BN_mul(C,B,D,ctx);
BN_rshift(C,C,128);
BN_mask_bits(C,128);
BN_copy(Z,C);
memset(_z,0,0x10);
break;
case 0x3A75:
BN_mask_bits(B,64);
BN_copy(Z,B);
memset(_z,0,8);
break;
case 0x3846:
mmB(B,16);
BN_mask_bits(Z,128);
memset(_z,0,0x10);
break;
case 0x3E92:
BN_copy(Z,A);
memset(_z,0,0x10);
break;
case 0x3A9C:
case 0x3CAA:
ti=1;
case 0x3E90:
case 0x3E95:
case 0x3C9F:
case 0x3CA5:
case 0x4692:
case 0x3A81:
case 0x3A86:
BN_zero(v);
BN_sub(J,v,D);
BN_set_bit(J,0);
BN_set_bit(v,64);
BN_mod_inverse(J,J,v,ctx);
BN_mask_bits(J,64);
BN_zero(v);
BN_set_bit(v,136);
BN_mod(B,v,D,ctx);
if (m==0x3A) tx=2;
for(int j=0;j<((A00[3]-((m==0x46)?0x82:0x85))>>3)+tx;j++) mmB(B,16);
if (ti) mmB(A,16);
if (xr==0x0C) BN_copy(Z,C);
BN_mask_bits(Z,128);
memset(_z,0,0x10);
break;
case 0x3D6D:
BN_copy(D,DAT);
BN_zero(v);
BN_sub(J,v,D);
BN_set_bit(J,0);
BN_set_bit(v,64);
BN_mod_inverse(J,J,v,ctx);
BN_mask_bits(J,64);
mmB(B,16);
BN_mask_bits(Z,128);
memset(_z,0,0x10);
break;
case 0x3AC9:
{
int o=1;
unsigned char u8[8];
for (int i=0;i<2;i++) {
memcpy(&u8[1],&_d[o<<3],7);
u8[0] = _d[(o<<3)+7];
memcpy(&_d[o<<3],u8,8);
}
BN_bin2bn(_d,0x10,Z);
memset(_z,0,16);
}
break;
case 0x3AF7:
case 0x394D:
BN_zero(Z);
memset(_z,0,0x10);
break;
case 0x395A:
BN_zero(Z);
BN_set_bit(Z,96);
memset(_z,0,0x10);
break;
case 0x3B5D:
BN_zero(Z);
BN_set_bit(Z,104);
memset(_z,0,0x10);
break;
case 0x2368:
ti = 1;
case 0x2362:
BN_zero(v);
BN_set_bit(v,136);
BN_mod(B,v,D,ctx);
mmB(B,16);
if (ti) mmB(B,16);
if (xr==0x0C) BN_copy(Z,C);
BN_mask_bits(Z,128);
memset(_z,0,0x10);
break;
case 0x2ECE:
ti=2;
BN_rshift(Z,DAT,8<<3);
BN_lshift(Z,Z,8<<3);
BN_add(Z,Z,J);
BN_rshift(Z,Z,ti<<3);
BN_mask_bits(Z,8<<3);
memset(_z,0,8);
break;
default:
printf("unhandled module case : %4.4X\n",(m<<8)|A00[3]);
break;
}
BN_bn2bin(Z,_z); RotateBytes(_z,BN_num_bytes(Z));

for (int i=11;i>-1;i--) hw[i]^=hw[i+4]; memset(&hw[4],0,0x7C);
}









Scooby

axtasee
03-07-2009, 08:24 AM
I was just wondering if anyone else is having issues with this I keep getting errors

gbad
03-07-2009, 08:42 AM
yeah same thing here

audiopro1971
03-07-2009, 08:48 AM
I am also having errors while compiling the latest module 1 test file.

joeaviator
03-07-2009, 08:48 AM
hit "return" to add a carriage return... very last line of the file should be "}" ONLY

Scoobydooo
03-07-2009, 08:51 AM
I was just wondering if anyone else is having issues with this I keep getting errors


Sorry bro, I missed the " } " at the very end.

Try it now. :)


Scooby

axtasee
03-07-2009, 08:51 AM
Thats cool man I thought I thought it was me I did that and compiled it started it up and still black channels so did one of u guys get it going

joeaviator
03-07-2009, 09:00 AM
No ... nevermind ... I tried the "}" and still black on everything. Bummer

Scoobydooo
03-07-2009, 09:03 AM
Thats cool man I thought I thought it was me I did that and compiled it started it up and still black channels so did one of u guys get it going

What vers are you running? I am running 1.34 and compiling with DJGPP. Running great.
Here is the exact module. Just take the .txt extension off file name.


Scooby

axtasee
03-07-2009, 09:15 AM
I am running the same thing except I am not sure about the abd after the 1.34 still kind of new to the cemu.The one u sent me worked good it might of been something I was doing thanks for sending that and your help

Scoobydooo
03-07-2009, 09:17 AM
I am running the same thing except I am not sure about the abd after the 1.34 still kind of new to the cemu

That "abd" was a typo bro. It's getting late. :)

Try using the module I attached in post 9. Just rename and take the ".txt" off of the end. Should be named module1.inc.


Scooby

Scoobydooo
03-07-2009, 09:34 AM
Maybe there is something I'm mising here? :confused:

If all else fails, you can follows these instructions and make your own edits like I did.

Thanks again to mpc30, tom4000, and ALL Cemu coders.

Looks like 2.12b is the way to go, but if you want to try these fixes for the latest module1. It's based on tom4000 posted.
There are 2 new maps 0x3B7F & 0x2368.
for the 0x3B7F

case 0x3963:
case 0x3967:
case 0x3B41:
case 0x3B7B:
case 0x3B7F: //<- add this
for the 0x2368

case 0x2368: //<- add this
ti = 1; //<- and this
case 0x2362:
BN_zero(v);
BN_set_bit(v,136);
BN_mod(B,v,D,ctx);
mmB(B,16);
if (ti) mmB(B,16); //<- and this
if (xr==0x0C) BN_copy(Z,C); //from Brew21 3/3/09
BN_mask_bits(Z,128);
memset(_z,0,0x10);
break;



These edits are for module 1 posted here...

http://www.dssftp.com/forum/showthread.php?t=81202



Scooby

mark46808
03-20-2009, 06:28 PM
where can I get the 1.34 or 1.94 bootdisk the 2.12a is frezeing havent seen any fix for it any nug toward any thing working would be great and thanks in advances

JT
03-20-2009, 06:51 PM
source files are in the emulation files section at bellexpress.vu