rdoeffinger / xwa_ddraw_d3d11 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jeremyansel/xwa_ddraw_d3d11
Direct3D 11 implementation of DDraw.dll for XWA
License: MIT License
This project forked from jeremyansel/xwa_ddraw_d3d11
Direct3D 11 implementation of DDraw.dll for XWA
License: MIT License
Some joysticks seem to have issue with e.g. drifting if the in-game deadzone handling is patched out.
It is of course possible to just leave that enabled by default, but it generally seems too extreme by default and makes it hard to aim for anyone with good joysticks.
So this ticket is meant for collecting data on different joysticks/gamepads to see if there is a reasonable compromise.
To collect data run the JoystickStats.exe file (download from release page: https://github.com/rdoeffinger/xwa_ddraw_d3d11/releases/download/v1.5.13/JoystickStats.exe ). Move the joystick, then let it return to center position and press button/"A" button.
Let it run for a bit without moving the joystick and copy-paste the output line (to copy press Ctrl+M, mark text, press enter).
Example for my Logitech Extreme 3D pro:
Try 1:
winmm: 32511,32767 min: 32511,32767 max:32511,32767
Try 2:
winmm: 32767,32767 min: 32767,32767 max:32767,32767
Try 3:
winmm: 32767,32511 min: 32767,32511 max:32767,32511
As you can see, normally the position is stable once the joystick is in center (min and max are the same), however it doesn't always return to exact center but is a bit above 200 units (less than 1% as it uses the full 0 to 65535 range) off.
My issue is that my Y axis was not inverted. Pulling on the stick should pitch the craft up. I did not have this issue with the previous ddraw versions. Other people had this issue as well.
I believe I also recall an issue with someone who had to force the joystick emulation to off as it was messing with his physical joystick.
For those who do need Joystick emulation support, they can turn it on manually in the config, but most people will be using a joystick or controller of some sort so this should be set to off by default.
EDIT: It might be ok with JoystickEmul to -1 as default, but the InvertYAxis definitely should be set to 1.
Hi,
I like to upscale cutscene for XvT with AI the and I ask if is possible add avi support for cutscene.
Thanks !
I think a threshold for the constant should be based on the CMD in TIE Fighter. LODs are quick to show up in the CMD which makes it look really bad.
I thought I would put this in as it has been recently seen in XWA as well here: https://www.xwaupgrade.com/phpBB3/viewtopic.php?p=157850#p157850
The fix suggested here does work for XVT BOP as well which involves enabling MSAA via the cfg file to remove the graphical corruption that occurs when using the most recent version of ReShade in either games.
Like many other's I'm using the 60 fps patch and when MSAA is turned off I constantly get the maxed 60fps. When MSAA is turned on for me I'm dropping to 10-15 fps in the same mission to around 45-50 fps in XvT BOP.
It is only a minor drop but I have a i7 4770 running at ~4GHz and an nvidia 660 ti and even though that's not high spec I would have thought it would still handle 60 fps easily with MSAA enabled. I'm using all default opts no other mods.
The version of ReShade I normally use is 3.1.1.242 which gets this bug to occur about 1 in 20 missions. The latest version of ReShade causes it constantly.
As awesome as this is, it's annoying that it's stuck to full screen. I'd appreciate it if you found a way to get it to work under DxWnd, which can be found at https://sourceforge.net/projects/dxwnd/
Without the d3d11 wrapper, I'm able to use a windowed fullscreen mode. Unfortunately with my tests with X-Wing 95 and Tie Fighter 95, true windowed mode doesn't seem to work, but I am able to alt tab out of the window or get the cursor out of the window just fine. If you can get that at least working again, I'd really appreciate it. As it happens, it appears that new versions os XWAUCP and DSUCP come bundled with this by default, which makes it even more important for full compatibility.
Hello,
Justagai has reported an issue:
I forgot to mention Reimar's ddraw in windowed mode outright crashes the game in the hangar. I'll try to get some event viewer logs uploaded later.
See http://www.xwaupgrade.com/phpBB3/viewtopic.php?p=156268#p156268
Faulting application name: XWINGALLIANCE.EXE, version: 2.0.0.2, time stamp: 0x3765a9b7
Faulting module name: USER32.dll, version: 10.0.17134.376, time stamp: 0xbeaa4463
Exception code: 0xc00000fd
Fault offset: 0x00026fbb
Faulting process id: 0x22f0
Faulting application start time: 0x01d49a9ac72ad9ef
Faulting application path: D:\GOG Games\Star Wars - X-Wing Alliance\XWINGALLIANCE.EXE
Faulting module path: C:\WINDOWS\System32\USER32.dll
Report Id: de2060d5-b4ac-4f55-8160-d2b10b05b3e9
Faulting package full name:
Faulting package-relative application ID:
When running TIE Fighter with the newest AMD 17.1.1. drivers the game runs at around half the speed it should. This is with an RX 480. Previously using the 16.12.1 drivers and this version saw no performance issues. Switching back to the standard ddraw.dll fixed the issue, confirming it is an issue with the DirectX11 ddraw.dll and not the game in general.
Additional testing confirms that the AMD 16.12.2 drive also causes the same issue.
Note that this issue does not appear in X-Wing vs. TIE Fighter. I was unable to test X-Wing Alliance.
To replicate: Install the latest AMD drivers and run any mission in the Windows Collector Edition of TIE Fighter or X-Wing. The FPS should be around 10 FPS even though the game should run at 30.
workaround: rolling drivers back to 16.12.1 resolves the issue.
Tie Fighter Reconstructed (https://tinyurl.com/y6aqyz8s) improves the voice and music quality of Tie Fighter 1998, but because it uses a modified TIE95.exe file, it makes it incompatible with the implementation of ddraw.dll using Direct3D 11 (game just crashes when using 3D hardware). Can this be fixed?
I noticed from the last time i used it, you've added a throttle switch option on ddraw.cfg to switch from the annoying right analog to the triggers on xinput controllers (awesome actually, Thanks), and I have a request if would be possible, to assign the throttle to null input ? or off ? I use steam controller profile, and I find that the throttle option is rather useless to have, if you are either full stop or full throttle most of the time, or matching speeds, i rather give up 3 functions on my controller, since i use the triggers mostly to change action layers. Thanks !
This error pops up whenever I load into a mission itself in XWA. I'm not the only one who's seen this. This error doesn't seem to occur in Jeremy's version.
Using v1.5.10 rc1 on stock XWA (GOG install) leads to the whole screen being dimmed whenever a capital ship (e.g. cruiser/star destroyer) is targeted. Once a fighter-class ship is targeted, the dimming is gone.
No additional patches were activated, but I've tested with the 60fps patch and still had the same result.
The issue does not appear when @JeremyAnsel's latest version is used.
Strangely enough, X-Wing and XvT are not affected. Unfortunately since this isn't a crash I am unable to provide event viewer logs. Please let me know if I can gather anything else for the issue.
The FPS drop only occurs when using 60FPS. I am not using Jeremy's time hook but my own 60FPS hook. 30FPS mode would be fine of course. The issue only occurs when targeting something that is a container or larger.
I have RefreshLimit set to off and PresentSleepTime is not used.
I have uploaded a CPU profile of the issue. https://1drv.ms/u/s!AoEpIrw6LOkUjbcXobFFREagGK7xyQ
For some reason, xwa_ddraw stops the throttle (right or left trigger) working correct for TIE Fighter (1998). My OS is Windows 7 64-bit.
I tested as follows:
In this case, the right trigger works in increments to increase/decrease the throttle (I presume this is the correct behaviour). But obviously I can't run in 3D mode with the above.
So what happens is the throttle is 100% by default. If I hold down (and keep holding down) the right trigger it will go down to 0%. Release it and it goes back up to 100%. So I presume this isn't the way it should be, a fix or workaround would be appreciated.
Hi,
While using ddraw.dll for older games xwing, tie fighter & x-wing vs tie-fighter, the ability of using gamepad triggers as throttle axis is lost. I mean, there is an optional throttle implementation in the new config file but it is not working as the original game file i.e. pressing right trigger increase power while pressing left trigger decrease power. Is it possible to put this setting as an option?
-Mehmet
There seems to be some sort of flickering issue with the latest development.
Here is a link to the video showing the issue: https://1drv.ms/v/s!AoEpIrw6LOkUjccrXpg7AEqFc9lAlQ
This isn't really a priority but more of a "huh" type of deal. I wanted to see how a certain memory address would react with 3D Hardware turned off but it seems to crash immediately at the start of a mission.
Event viewer logs:
EDIT: If a fix disrupts 3D hardware in any way, then I'd rather keep no 3D hardware broken
Hi,
I have tried to replace to apply this patch to xwing95.exe but the quality is it is worse than before (too much pixel effect).
I the past I have tried this patch with xvt and I get better result, but not with xwing95.exe.
In both casse I have set: ScalingType = 1 (smoother, alpha blended scaling).
I need to use this patch becouse convert old ddraw to ddraw 11 and allow me to record cutscene and work.
But not the pixels are more evident.
Thare is a way to solve ?
Thanks !
Hi,
I play to xvt and with this update there is a huge improvement.
When I set ScalingType 1 the anti-alisiang work good, but the gamma is more dark.
I ask is possible add a gamma correction.
Thank You !
Hi there, just started playing X-Wing (1998) again and thanks to your work, it's very playable on Windows 10. I would however like to request relative mouse (to joystick) motion (like in FPS/arcade flight games) so I don't have to bring back the mouse to the exact location it was for level flight. This will also allow me to map mouse movement to my Xbox controller (via steam input) so I could navigate menus using the controller as well.
Thanks!
Hello,
I've run a few benchmark to compare lookup vs compute color conversion.
Here is the result;
compare 5 OK
compare 6 OK
bench_lookup: 28.2832 ms 4286578691 41943043 4286578688 41943043
bench_compute: 41.4348 ms 4286578691 41943043 4286578688 41943043
bench_compute_simd: 24.7041 ms 4286578691 41943043 4286578688 41943043
bench_colorkey: 16.5983 ms 4286578691 41943043 4286578688 4267704323
bench_colorkey_simd: 14.2981 ms 4286578691 41943043 4286578688 4267704323
bench_colorkey_skip_lookup: 26.9225 ms 4286578691 41943043 4286578688 4267704323
bench_colorkey_skip_compute: 38.8146 ms 4286578691 41943043 4286578688 4267704323
I've used this code:
#include <iostream>
#include <string>
#include <chrono>
const int g_loopCount = 0x1000000 + 3;
unsigned short g_srcArray16[g_loopCount];
unsigned int g_srcArray32[g_loopCount];
unsigned short g_dstArray16[g_loopCount];
unsigned int g_dstArray32[g_loopCount];
void initGlobalArray()
{
for (int i = 0; i < g_loopCount; i++)
{
g_srcArray16[i] = (unsigned short)i;
g_srcArray32[i] = (unsigned int)i;
g_dstArray16[i] = (unsigned short)i;
g_dstArray32[i] = (unsigned int)i;
}
}
void sumGlobalArray()
{
unsigned int sumSrc16 = 0;
unsigned int sumSrc32 = 0;
unsigned int sumDst16 = 0;
unsigned int sumDst32 = 0;
for (int i = 0; i < g_loopCount; i++)
{
sumSrc16 += g_srcArray16[i];
sumSrc32 += g_srcArray32[i];
sumDst16 += g_dstArray16[i];
sumDst32 += g_dstArray32[i];
}
std::cout << "\t" << sumSrc16 << " " << sumSrc32 << " " << sumDst16 << " " << sumDst32 << std::endl;
}
void measure(const char* name, void(*fct)())
{
auto start = std::chrono::high_resolution_clock::now();
if (fct)
{
fct();
}
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double, std::milli> ellapsed = end - start;
std::cout << name << ": " << ellapsed.count() << " ms";
}
unsigned char convertColorB8G8R8X8toB5G6R5_15(unsigned char c)
{
return (c * (0x1F * 2) + 0xFF) / (0xFF * 2);
}
unsigned char convertColorB8G8R8X8toB5G6R5_16(unsigned char c)
{
return (c * (0x3F * 2) + 0xFF) / (0xFF * 2);
}
unsigned char convertColorB8G8R8X8toB5G6R5_25(unsigned char c)
{
return (c * 7967 + 32768) >> 16;
}
unsigned char convertColorB8G8R8X8toB5G6R5_26(unsigned char c)
{
return (c * 16191 + 32768) >> 16;
}
void compare5()
{
std::cout << "compare 5";
bool error = false;
for (int i = 0; i < 256; i++)
{
unsigned char c = (unsigned char)i;
unsigned char c1 = convertColorB8G8R8X8toB5G6R5_15(c);
unsigned char c2 = convertColorB8G8R8X8toB5G6R5_25(c);
if (c1 != c2)
{
error = true;
break;
}
}
std::cout << (error ? " ERROR" : " OK") << std::endl;
}
void compare6()
{
std::cout << "compare 6";
bool error = false;
for (int i = 0; i < 256; i++)
{
unsigned char c = (unsigned char)i;
unsigned char c1 = convertColorB8G8R8X8toB5G6R5_16(c);
unsigned char c2 = convertColorB8G8R8X8toB5G6R5_26(c);
if (c1 != c2)
{
error = true;
break;
}
}
std::cout << (error ? " ERROR" : " OK") << std::endl;
}
class ColorConverterTables
{
public:
ColorConverterTables()
{
// X8toX5, X8toX6
for (unsigned int c = 0; c < 0x100; c++)
{
this->X8toX5[c] = (c * (0x1F * 2) + 0xFF) / (0xFF * 2);
this->X8toX6[c] = (c * (0x3F * 2) + 0xFF) / (0xFF * 2);
}
}
unsigned char X8toX5[0x100];
unsigned char X8toX6[0x100];
};
ColorConverterTables g_colorConverterTables;
unsigned short convert32to16_lookup(unsigned int color32)
{
unsigned int red = (color32 & 0xFF0000) >> 16;
unsigned int green = (color32 & 0xFF00) >> 8;
unsigned int blue = color32 & 0xFF;
red = g_colorConverterTables.X8toX5[red];
green = g_colorConverterTables.X8toX6[green];
blue = g_colorConverterTables.X8toX5[blue];
unsigned short color16 = (red << 11) | (green << 5) | blue;
return color16;
}
void bench_lookup()
{
unsigned short* dst = g_dstArray16;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
unsigned int color32 = src[i];
unsigned char red = (unsigned char)((color32 & 0xFF0000) >> 16);
unsigned char green = (unsigned char)((color32 & 0xFF00) >> 8);
unsigned char blue = (unsigned char)(color32 & 0xFF);
red = g_colorConverterTables.X8toX5[red];
green = g_colorConverterTables.X8toX6[green];
blue = g_colorConverterTables.X8toX5[blue];
unsigned int color16 = (red << 11) | (green << 5) | blue;
dst[i] = color16;
}
}
void bench_compute()
{
unsigned short* dst = g_dstArray16;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
unsigned int color32 = src[i];
unsigned char red = (unsigned char)((color32 & 0xFF0000) >> 16);
unsigned char green = (unsigned char)((color32 & 0xFF00) >> 8);
unsigned char blue = (unsigned char)(color32 & 0xFF);
red = (red * 7967 + 32768) >> 16;
green = (green * 16191 + 32768) >> 16;
blue = (blue * 7967 + 32768) >> 16;
unsigned int color16 = (red << 11) | (green << 5) | blue;
dst[i] = color16;
}
}
unsigned short convert32to16_compute(unsigned int color32)
{
unsigned int red = (color32 & 0xFF0000) >> 16;
unsigned int green = (color32 & 0xFF00) >> 8;
unsigned int blue = color32 & 0xFF;
red = (red * 7967 + 32768) >> 16;
green = (green * 16191 + 32768) >> 16;
blue = (blue * 7967 + 32768) >> 16;
unsigned short color16 = (red << 11) | (green << 5) | blue;
return color16;
}
void bench_compute_simd()
{
unsigned short* dst = g_dstArray16;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
dst[i] = convert32to16_compute(src[i]);
}
}
void bench_colorkey()
{
unsigned int* dst = g_dstArray32;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
unsigned int color32 = src[i];
if (color32 == 0x200000)
{
dst[i] = 0xff000000;
}
else
{
dst[i] = color32 & 0xffffff;
}
}
}
unsigned int convert32Colorkey(unsigned int color32)
{
if (color32 == 0x200000)
{
color32 = 0xff000000;
}
else
{
color32 = color32 & 0xffffff;
}
return color32;
}
void bench_colorkey_simd()
{
unsigned int* dst = g_dstArray32;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
dst[i] = convert32Colorkey(src[i]);
}
}
void bench_colorkey_skip_lookup()
{
unsigned short* dst = g_dstArray16;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
unsigned int color32 = src[i];
if (color32 == 0x200000)
continue;
dst[i] = convert32to16_lookup(color32);
}
}
void bench_colorkey_skip_compute()
{
unsigned short* dst = g_dstArray16;
unsigned int* src = g_srcArray32;
int size = g_loopCount;
for (int i = 0; i < size; i++)
{
unsigned int color32 = src[i];
if (color32 == 0x200000)
continue;
dst[i] = convert32to16_compute(color32);
}
}
#define BENCH(fct) measure(#fct, (fct)); sumGlobalArray();
void main()
{
compare5();
compare6();
initGlobalArray();
BENCH(bench_lookup);
BENCH(bench_compute);
BENCH(bench_compute_simd);
BENCH(bench_colorkey);
BENCH(bench_colorkey_simd);
BENCH(bench_colorkey_skip_lookup);
BENCH(bench_colorkey_skip_compute);
}
It seems that compute is faster than lookup when SIMD is used, and lookup is faster than compute when SIMD is not used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.