Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
melonDS
Commits
c4d9d27e
Commit
c4d9d27e
authored
Mar 01, 2017
by
StapleButter
Browse files
master brightness
parent
bc335e31
Changes
4
Hide whitespace changes
Inline
Side-by-side
GPU2D.cpp
View file @
c4d9d27e
...
...
@@ -83,6 +83,8 @@ void GPU2D::Reset()
memset
(
BGRotC
,
0
,
2
*
2
);
memset
(
BGRotD
,
0
,
2
*
2
);
MasterBrightness
=
0
;
BGExtPalStatus
[
0
]
=
0
;
BGExtPalStatus
[
1
]
=
0
;
BGExtPalStatus
[
2
]
=
0
;
...
...
@@ -170,6 +172,8 @@ void GPU2D::Write16(u32 addr, u16 val)
case
0x032
:
BGRotB
[
1
]
=
val
;
return
;
case
0x034
:
BGRotC
[
1
]
=
val
;
return
;
case
0x036
:
BGRotD
[
1
]
=
val
;
return
;
case
0x06C
:
MasterBrightness
=
val
;
return
;
}
//printf("unknown GPU write16 %08X %04X\n", addr, val);
...
...
@@ -265,6 +269,50 @@ void GPU2D::DrawScanline(u32 line)
break
;
}
// master brightness
if
((
MasterBrightness
>>
14
)
==
1
)
{
// up
u32
factor
=
MasterBrightness
&
0x1F
;
if
(
factor
>
16
)
factor
=
16
;
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
u32
val
=
dst
[
i
];
u32
r
=
val
&
0x00003F
;
u32
g
=
val
&
0x003F00
;
u32
b
=
val
&
0x3F0000
;
r
+=
(((
0x00003F
-
r
)
*
factor
)
>>
4
);
g
+=
((((
0x003F00
-
g
)
*
factor
)
>>
4
)
&
0x003F00
);
b
+=
((((
0x3F0000
-
b
)
*
factor
)
>>
4
)
&
0x3F0000
);
dst
[
i
]
=
r
|
g
|
b
;
}
}
else
if
((
MasterBrightness
>>
14
)
==
2
)
{
// down
u32
factor
=
MasterBrightness
&
0x1F
;
if
(
factor
>
16
)
factor
=
16
;
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
u32
val
=
dst
[
i
];
u32
r
=
val
&
0x00003F
;
u32
g
=
val
&
0x003F00
;
u32
b
=
val
&
0x3F0000
;
r
-=
((
r
*
factor
)
>>
4
);
g
-=
(((
g
*
factor
)
>>
4
)
&
0x003F00
);
b
-=
(((
b
*
factor
)
>>
4
)
&
0x3F0000
);
dst
[
i
]
=
r
|
g
|
b
;
}
}
// convert to 32-bit RGBA
for
(
int
i
=
0
;
i
<
256
;
i
++
)
dst
[
i
]
=
((
dst
[
i
]
&
0x003F3F3F
)
<<
2
)
|
...
...
GPU2D.h
View file @
c4d9d27e
...
...
@@ -64,6 +64,8 @@ private:
u32
BlendFunc
;
u16
MasterBrightness
;
u16
BGExtPalCache
[
4
][
16
*
256
];
u16
OBJExtPalCache
[
16
*
256
];
u32
BGExtPalStatus
[
4
];
...
...
NDS.cpp
View file @
c4d9d27e
...
...
@@ -1624,12 +1624,12 @@ void ARM9IOWrite16(u32 addr, u16 val)
return
;
}
if
(
addr
>=
0x04000000
&&
addr
<
0x04000060
)
if
(
(
addr
>=
0x04000000
&&
addr
<
0x04000060
)
||
(
addr
==
0x0400006C
))
{
GPU
::
GPU2D_A
->
Write16
(
addr
,
val
);
return
;
}
if
(
addr
>=
0x04001000
&&
addr
<
0x04001060
)
if
(
(
addr
>=
0x04001000
&&
addr
<
0x04001060
)
||
(
addr
==
0x0400106C
))
{
GPU
::
GPU2D_B
->
Write16
(
addr
,
val
);
return
;
...
...
melonDS.depend
View file @
c4d9d27e
...
...
@@ -10,7 +10,7 @@
1481161027 c:\documents\sources\melonds\types.h
1488
28193
1 source:c:\documents\sources\melonds\nds.cpp
1488
39302
1 source:c:\documents\sources\melonds\nds.cpp
<stdio.h>
<string.h>
"NDS.h"
...
...
@@ -87,13 +87,13 @@
"NDS.h"
"SPI.h"
1488
281814
source:c:\documents\sources\melonds\gpu2d.cpp
1488
396037
source:c:\documents\sources\melonds\gpu2d.cpp
<stdio.h>
<string.h>
"NDS.h"
"GPU.h"
1488
225922
c:\documents\sources\melonds\gpu2d.h
1488
392627
c:\documents\sources\melonds\gpu2d.h
1481040524 c:\documents\sources\melonds\wifi.h
...
...
@@ -155,7 +155,7 @@
"GPU.h"
"FIFO.h"
1488
244847
source:c:\documents\sources\melonds\gpu3d_soft.cpp
1488
390544
source:c:\documents\sources\melonds\gpu3d_soft.cpp
<stdio.h>
<string.h>
"NDS.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment