mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
Nuking commit because i did deleted everything once as it was a fork
This commit is contained in:
commit
3be408f6e7
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: EduApps-CDG
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report crashes, rendering issues etc.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Please describe your issue as accurately as possible. If you run into a problem with a binary release, make sure to test with latest `master` as well.
|
||||
|
||||
**Important:** When reporting an issue with a specific game or application, such as crashes or rendering issues, please include log files and, if possible, a D3D11/D3D9 Apitrace (see https://github.com/apitrace/apitrace) so that the issue can be reproduced.
|
||||
In order to create a trace for **D3D11/D3D10**: Run `wine apitrace.exe trace -a dxgi YOURGAME.exe`.
|
||||
In order to create a trace for **D3D9**: Follow https://github.com/Joshua-Ashton/d9vk/wiki/Making-a-Trace.
|
||||
Preferably record the trace on Windows, or wined3d if possible.
|
||||
|
||||
**Reports with no log files will be ignored.**
|
||||
|
||||
### Software information
|
||||
Name of the game, settings used etc.
|
||||
|
||||
### System information
|
||||
- GPU:
|
||||
- Driver:
|
||||
- Wine version:
|
||||
- DXVK version:
|
||||
|
||||
### Apitrace file(s)
|
||||
- Put a link here
|
||||
|
||||
### Log files
|
||||
- d3d9.log:
|
||||
- d3d11.log:
|
||||
- dxgi.log:
|
31
.github/workflows/cmake.yml
vendored
Normal file
31
.github/workflows/cmake.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Auto-build and Resolve dependencies
|
||||
run: ./build.sh
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C ${{env.BUILD_TYPE}}
|
||||
|
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
build
|
||||
.kdev4
|
||||
OpenDX.kdev4
|
||||
!build/.no-delete
|
47
.vscode/c_cpp_properties.json
vendored
Normal file
47
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${workspaceFolder}/include",
|
||||
"${workspaceFolder}/prod_include",
|
||||
"/usr/include/c++/12",
|
||||
"/usr/include/x86_64-linux-gnu/c++/12",
|
||||
"/usr/include/c++/12/backward",
|
||||
"/usr/lib/gcc/x86_64-linux-gnu/12/include",
|
||||
"/usr/local/include",
|
||||
"/usr/include/x86_64-linux-gnu",
|
||||
"/usr/include",
|
||||
"/usr/include/pango-1.0",
|
||||
"/usr/include/gtk-4.0",
|
||||
"/usr/include/glib-2.0",
|
||||
"/usr/include/pango-1.0",
|
||||
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
|
||||
"/usr/include/harfbuzz",
|
||||
"/usr/include/freetype2",
|
||||
"/usr/include/libpng16",
|
||||
"/usr/include/libmount",
|
||||
"/usr/include/blkid",
|
||||
"/usr/include/fribidi",
|
||||
"/usr/include/cairo",
|
||||
"/usr/include/pixman-1",
|
||||
"/usr/include/gdk-pixbuf-2.0",
|
||||
"/usr/include/graphene-1.0",
|
||||
"/usr/lib/x86_64-linux-gnu/graphene-1.0/include"
|
||||
],
|
||||
"compilerArgs": [
|
||||
"-I${workspaceFolder}/include/d3d12.so",
|
||||
"-I${workspaceFolder}/include/dxgi.so",
|
||||
"-I${workspaceFolder}/include/wrl"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cppStandard": "gnu++20",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"cStandard": "gnu23",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
34
.vscode/launch.json
vendored
Normal file
34
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"configurations": [
|
||||
//cmake then make in build folder
|
||||
{
|
||||
"name": "dxdiag",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/dxdiag",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/build",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
|
||||
//sample (also in build folder)
|
||||
{
|
||||
"name": "sample",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/tests/sample",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/build",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"mesonbuild.configureOnOpen": true,
|
||||
"C_Cpp.codeAnalysis.clangTidy.checks.disabled": [
|
||||
"clang-diagnostic-pragma-once-outside-header"
|
||||
]
|
||||
}
|
51
.vscode/tasks.json
vendored
Normal file
51
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++ build active file",
|
||||
"command": "/usr/bin/g++",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}/${fileBasenameNoExtension}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
},
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: gcc build active file",
|
||||
"command": "/usr/bin/gcc",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}/${fileBasenameNoExtension}",
|
||||
"-I${workspaceFolder}/include/d3d12.so",
|
||||
"-I${workspaceFolder}/include/dxgi.so",
|
||||
"-I${workspaceFolder}/include/wrl"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": "build",
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
62
CMakeLists.txt
Normal file
62
CMakeLists.txt
Normal file
@ -0,0 +1,62 @@
|
||||
# SPDX-FileCopyrightText: 2023 <copyright holder> <email>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# - Try to find
|
||||
# Once done this will define
|
||||
# _FOUND - System has
|
||||
# _INCLUDE_DIRS - The include directories
|
||||
# _LIBRARIES - The libraries needed to use
|
||||
# _DEFINITIONS - Compiler switches required for using
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(OpenDX)
|
||||
set(PROJECT_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_ QUIET )
|
||||
set(_DEFINITIONS ${PC__CFLAGS_OTHER})
|
||||
|
||||
find_path(_INCLUDE_DIR
|
||||
HINTS ${PC__INCLUDEDIR} ${PC__INCLUDE_DIRS}
|
||||
PATH_SUFFIXES )
|
||||
|
||||
find_library(_LIBRARY NAMES
|
||||
HINTS ${PC__LIBDIR} ${PC__LIBRARY_DIRS} )
|
||||
|
||||
set(_LIBRARIES ${_LIBRARY} )
|
||||
set(_INCLUDE_DIRS ${_INCLUDE_DIR} )
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set _FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args( DEFAULT_MSG
|
||||
_LIBRARY _INCLUDE_DIR)
|
||||
mark_as_advanced(_INCLUDE_DIR _LIBRARY )
|
||||
|
||||
#base include
|
||||
include_directories(./include)
|
||||
configure_file(include/config.hpp.in ../include/config.hpp)
|
||||
|
||||
#production include (for use with .so files)
|
||||
include_directories(./prod_include)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
#d3d9.so:
|
||||
add_library(d3d9 SHARED libs/d3d9/d3d9.cpp)
|
||||
|
||||
#dxdiag:
|
||||
pkg_check_modules(GTK4 REQUIRED gtk4)
|
||||
|
||||
|
||||
include_directories(${GTK4_INCLUDE_DIRS})
|
||||
link_directories(${GTK4_LIBRARY_DIRS})
|
||||
|
||||
add_executable(dxdiag tools/dxdiag/main.cpp)
|
||||
target_link_libraries(dxdiag ${GTK4_LIBRARIES})
|
||||
target_link_libraries(dxdiag d3d9)
|
||||
|
||||
|
||||
#add ./tests/CMakeLists.txt
|
||||
add_subdirectory(tests)
|
22
CONTRIBUTING.md
Normal file
22
CONTRIBUTING.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Contributing
|
||||
This guide shows how to prepare your environment to contribute for OpenDX.
|
||||
|
||||
## Dependencies
|
||||
First, install these dependencies (older versions might work, but it's not guaranteed).
|
||||
|
||||
| Dependency | Version |
|
||||
|:-|-:|
|
||||
|[`cmake`](https://packages.ubuntu.com/kinetic/cmake)|`3.25.1`|
|
||||
|[`libgtk-4-dev`](https://packages.ubuntu.com/kinetic/libgtk-4-dev)|`4.10.1`|
|
||||
|
||||
|
||||
## Building and running
|
||||
These are the same universal steps for cmake:
|
||||
|
||||
```sh
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
# run dxdiag
|
||||
./dxdiag
|
||||
```
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Eduardo Procopio Gomez
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
48
README.md
Normal file
48
README.md
Normal file
@ -0,0 +1,48 @@
|
||||
<div align=center>
|
||||
<img src="./img/logo.png" width=260>
|
||||
<br>
|
||||
|
||||
# OpenDX
|
||||
<i>The Open Source DirectX alternative for Linux.</i>
|
||||
|
||||
**Compile:** `./build.sh && ./run.sh`
|
||||
|
||||
[](https://github.com/EduApps-CDG/OpenDX/actions/workflows/cmake.yml)
|
||||
</div>
|
||||
|
||||
## WTF is this?
|
||||
Do you miss DirectX when playing games on Linux?
|
||||
Are you tired of relying on Wine or other compatibility layers for running games that rely on DirectX?
|
||||
**OpenDX is here to change that!**
|
||||
Our project aims to provide a fully-featured implementation of DirectX for the Linux operating system, without the need for compatibility layers or emulators.
|
||||
|
||||
### What OpenDX is not
|
||||
OpenDX it's not intended to be used as a compatibility layer for running Windows games on Linux. It's meant to be used on Linux games that rely on DirectX. We are not planning to implement the Windows API, but we are planning to implement the DirectX API.
|
||||
|
||||
## Introducing the First Component: dxdiag
|
||||
<div align=center>
|
||||
|
||||

|
||||
</div>
|
||||
We're proud to announce the first component of our project: a functional implementation of the DirectX Diagnostic Tool (dxdiag).
|
||||
This tool provides detailed information about the DirectX installation and capabilities of your Linux system, just like it does on Windows.
|
||||
With OpenDX, you can now check the compatibility of your Linux system with DirectX games and applications.
|
||||
|
||||
**Please note: Currently, dxdiag only works with one screen, but we are working on expanding its capabilities.**
|
||||
|
||||
## Improved Performance
|
||||
We believe that Linux should have a native implementation of DirectX, which will provide improved performance and compatibility compared to compatibility layers such as Wine.
|
||||
Although the project is still in development and we have a long way to go, we are committed to bringing you the best possible experience when playing DirectX games on Linux.
|
||||
|
||||
Here's a list of what OpenDX does better than Windows:
|
||||
* dxdiag: Even on 11th gen Intel CPUs, dxdiag takes some time to open on Windows. On OpenDX, it opens instantly. Also, in the System tab, OpenDX shows the correct date and time, while Windows shows the date and time when dxdiag was opened (*lol*).
|
||||
|
||||
## Join the OpenDX Community
|
||||
We need your help to make OpenDX a success.
|
||||
If you're a developer, you can contribute to the project by fixing bugs, adding new features, and improving performance.
|
||||
If you're not a developer, you can still help by giving us feedback, testing the software, and spreading the word about OpenDX.
|
||||
|
||||
## Give us a Star and Contribute
|
||||
Please show your support for OpenDX by giving us a star on GitHub and spreading the word about the project. We believe that together, we can bring the best of DirectX to Linux and provide an improved gaming experience for everyone.
|
||||
|
||||
Join us on our journey to bring DirectX to Linux!
|
23
build.sh
Executable file
23
build.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# This file will install the required packages and build the project
|
||||
|
||||
# Check if package is installed
|
||||
function check_package {
|
||||
if ! dpkg -s $1 > /dev/null 2>&1; then
|
||||
echo "Package $1 is not installed. Installing..."
|
||||
sudo apt install $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if package is installed
|
||||
check_package "gcc"
|
||||
check_package "cmake"
|
||||
check_package "make"
|
||||
check_package "libgtk-4-dev"
|
||||
|
||||
# Build the project
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
|
||||
echo "Build complete, run ./run.sh to run the program"
|
0
build/.no-delete
Normal file
0
build/.no-delete
Normal file
BIN
img/logo.png
Normal file
BIN
img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 KiB |
BIN
img/print.png
Normal file
BIN
img/print.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
6
include/config.hpp
Normal file
6
include/config.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define DEBUG false
|
||||
|
||||
//PREPROCESSING ONLY!!!
|
||||
#define PROJECT_SOURCE_DIR "/home/eduardo/Documentos/proj/OpenDX/"
|
6
include/config.hpp.in
Normal file
6
include/config.hpp.in
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define DEBUG false
|
||||
|
||||
//PREPROCESSING ONLY!!!
|
||||
#define PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@/"
|
17
include/preprocessor/GetFileContent.hpp
Normal file
17
include/preprocessor/GetFileContent.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
/**
|
||||
* Caution: by using that function,
|
||||
* it means that every time it's called
|
||||
* the file content will be included in the code
|
||||
*/
|
||||
#define GetFileContent(file_path) []() -> std::string { \
|
||||
std::ifstream file(file_path); \
|
||||
std::stringstream buffer; \
|
||||
buffer << file.rdbuf(); \
|
||||
return buffer.str(); \
|
||||
}()
|
79
include/types/Translation.hpp
Normal file
79
include/types/Translation.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct {
|
||||
//Common texts
|
||||
char* yes;
|
||||
char* no;
|
||||
char* not_available;
|
||||
char* enabled;
|
||||
|
||||
//Tab names
|
||||
char* tab_system;
|
||||
char* tab_display;
|
||||
char* tab_sound;
|
||||
char* tab_input;
|
||||
|
||||
//Buttons
|
||||
char* btn_help;
|
||||
char* btn_next;
|
||||
char* btn_save;
|
||||
char* btn_exit;
|
||||
|
||||
//Tab System
|
||||
char* system_description; //This tool reports [...]
|
||||
char* system_info_label; //Section System Info
|
||||
char* system_info_currentDate;
|
||||
char* system_info_pcName;
|
||||
char* system_info_os;
|
||||
char* system_info_language;
|
||||
char* system_info_manufacturer;
|
||||
char* system_info_model;
|
||||
char* system_info_bios;
|
||||
char* system_info_processor;
|
||||
char* system_info_memory;
|
||||
char* system_info_pageFile;
|
||||
char* system_info_directxVersion;
|
||||
char* system_info_opendxVersion; //exclusive :)
|
||||
|
||||
//Tab Display X
|
||||
char* display_device_label; // section Device
|
||||
char* display_device_manufacturer;
|
||||
char* display_device_chipType;
|
||||
char* display_device_dacType;
|
||||
char* display_device_type;
|
||||
char* display_device_mem;
|
||||
char* display_device_videoMem;
|
||||
char* display_device_sharedMem;
|
||||
char* display_device_currDisplayMode;
|
||||
char* display_device_monitor;
|
||||
char* display_driver_label; //section Drivers
|
||||
char* display_driver_mainDriver;
|
||||
char* display_driver_version;
|
||||
char* display_driver_date;
|
||||
char* display_driver_whqlLogo;
|
||||
char* display_driver_d3dDdi;
|
||||
char* display_driver_featureLevels;
|
||||
char* display_driver_model;
|
||||
char* display_features_label; //section DirecX Features
|
||||
char* display_features_ddAccel;
|
||||
char* display_features_d3dAccel;
|
||||
char* display_features_agpAccel;
|
||||
char* display_notes_label; //section Notes
|
||||
|
||||
//Tab Sound
|
||||
char* sound_device_label; //section Device
|
||||
char* sound_device_name;
|
||||
char* sound_device_hardwareId;
|
||||
char* sound_device_manufacturerId;
|
||||
char* sound_device_productId;
|
||||
char* sound_device_type;
|
||||
char* sound_device_default;
|
||||
char* sound_driver_label; //section Drivers
|
||||
char* sound_driver_name;
|
||||
char* sound_driver_version;
|
||||
char* sound_driver_date;
|
||||
char* sound_driver_whqlLogo;
|
||||
char* sound_driver_otherFiles;
|
||||
char* sound_driver_provider;
|
||||
char* sound_notes_label; //section Notes
|
||||
} Translation_t;
|
7
include/winbase.h
Normal file
7
include/winbase.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
|
||||
inline LONG InterlockedIncrement(LONG volatile *p)
|
||||
{
|
||||
return __sync_add_and_fetch(p, 1);
|
||||
}
|
1
libs/Ole32/Ole32.cpp
Normal file
1
libs/Ole32/Ole32.cpp
Normal file
@ -0,0 +1 @@
|
||||
|
107
libs/d3d9/d3d9.cpp
Normal file
107
libs/d3d9/d3d9.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
#include <windows.h>
|
||||
#include "d3d9helper.hpp"
|
||||
#include "d3d9.hpp"
|
||||
#include "d3dobject.hpp"
|
||||
#include <iostream>
|
||||
#include <winbase.h>
|
||||
#include <drm/drm.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
|
||||
IDirect3D9::IDirect3D9 (UINT SDKVersion) {
|
||||
//Create connection with DRM
|
||||
int fd = open("/dev/dri/card0", O_RDWR, 0); //DirectX automatically selects the first GPU
|
||||
|
||||
if (fd < 0) {
|
||||
std::cerr << "\033[1;31m" //RED BOLD
|
||||
<< "ODX ERROR: Failed to open /dev/dri/card0. Please check if you have the proper permissions to access the device." << std::endl
|
||||
<< "Direct3DCreate9 fails and returns NULL.\033[0;0m" << std::endl
|
||||
<< std::endl;
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
//check if the device is Hardware or Software (Does DirectX have this check?)
|
||||
unsigned int gpuType;
|
||||
|
||||
int ioctlResult = ioctl(fd, DRM_IOCTL_GET_CAP, &gpuType);
|
||||
if (ioctlResult != 0) {
|
||||
std::cerr << "\033[1;31m"
|
||||
<< "ODX ERROR: Failed to get device info" << std::endl
|
||||
<< "Direct3DCreate9 fails and returns NULL.\033[0;0m" << std::endl
|
||||
<< std::endl;
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "\033[1;32m" //GREEN BOLD
|
||||
<< "ODX INFO: Device is " << (gpuType == DRM_CAP_DUMB_BUFFER ? "Software" : "Hardware") << std::endl
|
||||
<< "\033[0;0m" << std::endl;
|
||||
|
||||
IDirect3DDevice9* device;
|
||||
this->CreateDevice(
|
||||
D3DADAPTER_DEFAULT,
|
||||
D3DDEVTYPE::D3DDEVTYPE_SW, // TODO
|
||||
NULL, // TODO
|
||||
NULL, // TODO
|
||||
NULL, // TODO
|
||||
&device
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ULONG IDirect3D9::AddRef() {
|
||||
DXGASSERT(((ULONG_PTR)(&m_cRef) & 3) == 0);
|
||||
|
||||
InterlockedIncrement((LONG *)&m_cRef);
|
||||
return m_cRef;
|
||||
}
|
||||
|
||||
|
||||
HRESULT IDirect3D9::CreateDevice(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
HWND hFocusWindow,
|
||||
DWORD BehaviorFlags,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DDevice9 **ppReturnedDeviceInterface
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ULONG IDirect3D9::Release() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HRESULT IDirect3D9::QueryInterface ( REFIID riid, void ** ppvObj ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
IDirect3D9* Direct3DCreate9(UINT SDKVersion) {
|
||||
HINSTANCE instance = NULL;
|
||||
constexpr const UINT supported_sdk = 0x0900;
|
||||
|
||||
if (SDKVersion != supported_sdk) {
|
||||
std::cout << "\033[1;31m" //RED BOLD
|
||||
<< std::endl
|
||||
<< "D3D ERROR: This application compiled against improper D3D headers." << std::endl
|
||||
<< "The application is compiled with SDK version (" << SDKVersion << ") but the currently installed" << std::endl
|
||||
<< "runtime supports versions from (" << supported_sdk << ")." << std::endl
|
||||
<< "Please recompile with an up-to-date SDK.\033[0;0m" << std::endl
|
||||
<< std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IDirect3D9* r = new IDirect3D9(SDKVersion);
|
||||
|
||||
if (r == NULL)
|
||||
std::cout << "\033[0;31m"
|
||||
<< "Creating D3D enumeration object failed; out of memory. Direct3DCreate fails and returns NULL.\033[0;0m" << std::endl;
|
||||
|
||||
return r;
|
||||
}
|
30
libs/d3d9/d3d9.hpp
Normal file
30
libs/d3d9/d3d9.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include "d3d9helper.hpp"
|
||||
#include "d3d9types.hpp"
|
||||
#include "idirect3ddevice9.hpp"
|
||||
|
||||
// struct IDirect3D9 : public IUnknown {
|
||||
// IDirect3D9(UINT SDKVersion);
|
||||
|
||||
// HRESULT QueryInterface(REFIID riid, void** ppvObj);
|
||||
// ULONG AddRef();
|
||||
// ULONG Release();
|
||||
|
||||
// HRESULT CreateDevice(
|
||||
// UINT Adapter,
|
||||
// D3DDEVTYPE DeviceType,
|
||||
// HWND hFocusWindow,
|
||||
// DWORD BehaviorFlags,
|
||||
// D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
// IDirect3DDevice9 **ppReturnedDeviceInterface
|
||||
// );
|
||||
|
||||
// private:
|
||||
// DWORD m_cRef;
|
||||
|
||||
// // Define other methods required by IDirect3D9 interface
|
||||
// };
|
||||
|
||||
typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9;
|
||||
IDirect3D9* Direct3DCreate9(UINT SDKVersion);
|
9
libs/d3d9/d3d9helper.hpp
Normal file
9
libs/d3d9/d3d9helper.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <unknwn.h>
|
||||
#include "idirect3ddevice9.hpp"
|
||||
|
||||
/**
|
||||
* IDirect3D9
|
||||
*/
|
||||
typedef IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9;
|
||||
typedef IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
|
22
libs/d3d9/d3d9macros.hpp
Normal file
22
libs/d3d9/d3d9macros.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
//not sure if this goes here.
|
||||
/*#define API_ENTER_NO_LOCK() \
|
||||
do { \
|
||||
InterlockedIncrement(&g_nInsideAPI); \
|
||||
} while (false)*/
|
||||
|
||||
// #ifdef _DEBUG
|
||||
// #define DXGASSERT(exp) do { \
|
||||
// if (!(exp)) { \
|
||||
// fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", #exp, __FILE__, __LINE__); \
|
||||
// abort(); \
|
||||
// } \
|
||||
// } while (0)
|
||||
// #else
|
||||
// #define DXGASSERT(exp) ((void)0)
|
||||
// #endif
|
||||
|
||||
// #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
// ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
|
||||
// ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
|
3
libs/d3d9/d3d9types.hpp
Normal file
3
libs/d3d9/d3d9types.hpp
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include <d3d9.h>
|
12
libs/d3d9/d3dobject.cpp
Normal file
12
libs/d3d9/d3dobject.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "idirect3ddevice9.hpp"
|
||||
|
||||
class D3DObject {
|
||||
public:
|
||||
D3DObject(IDirect3DDevice9* device) : m_device(device) {}
|
||||
virtual ~D3DObject() {}
|
||||
|
||||
virtual void render() = 0;
|
||||
|
||||
protected:
|
||||
IDirect3DDevice9* m_device;
|
||||
};
|
11
libs/d3d9/d3dobject.hpp
Normal file
11
libs/d3d9/d3dobject.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "idirect3ddevice9.hpp"
|
||||
|
||||
class D3DObject {
|
||||
public:
|
||||
D3DObject(IDirect3DDevice9* device):m_device(device) {
|
||||
// TODO: complete
|
||||
}
|
||||
protected:
|
||||
IDirect3DDevice9* m_device;
|
||||
};
|
7
libs/d3d9/idirect3ddevice9.hpp
Normal file
7
libs/d3d9/idirect3ddevice9.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <unknwn.h>
|
||||
#include <d3d9.h>
|
||||
|
||||
// struct IDirect3DDevice9:IUnknown {
|
||||
|
||||
// };
|
13
libs/opendx/README.md
Normal file
13
libs/opendx/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# libopendx.so
|
||||
Here goes everything that's not part of DirectX library.
|
||||
Some examples are:
|
||||
* DLL files that DirectX depends on will be turned into `libopendx.so`
|
||||
such as kernel32.dll.
|
||||
* Essential external functions and definitions needed to mantain software
|
||||
compatibility such as functions contained in <windows.h>. But the headers
|
||||
will be found in [`/prod_include`](../../prod_include).
|
||||
|
||||
All of these examples will be built in a single library and that's what
|
||||
`libopendx.so` does.`
|
||||
|
||||
The main file is [`./opendx.cpp`](./opendx.cpp)
|
1
libs/opendx/opendx.cpp
Normal file
1
libs/opendx/opendx.cpp
Normal file
@ -0,0 +1 @@
|
||||
|
1
libs/opendx/opendx.hpp
Normal file
1
libs/opendx/opendx.hpp
Normal file
@ -0,0 +1 @@
|
||||
|
3
prod_include/README.md
Normal file
3
prod_include/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# prod_include
|
||||
This folder contains headers that you can use as reference to
|
||||
port your software for Linux.
|
238
prod_include/d3d9.h
Normal file
238
prod_include/d3d9.h
Normal file
@ -0,0 +1,238 @@
|
||||
/**
|
||||
* Production "d3d9.h" file.
|
||||
*
|
||||
* TODO: Auto-generate this file from internal headers.
|
||||
*/
|
||||
#ifndef _D3D9_H
|
||||
#define _D3D9_H
|
||||
#include <windows.h>
|
||||
#include <winerror.h>
|
||||
#include <unknwn.h>
|
||||
|
||||
UINT D3D_SDK_VERSION = 0x0900;
|
||||
|
||||
#define D3DADAPTER_DEFAULT 0
|
||||
|
||||
//not sure if this goes here.
|
||||
/*#define API_ENTER_NO_LOCK() \
|
||||
do { \
|
||||
InterlockedIncrement(&g_nInsideAPI); \
|
||||
} while (false)*/
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DXGASSERT(exp) do { \
|
||||
if (!(exp)) { \
|
||||
fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", #exp, __FILE__, __LINE__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define DXGASSERT(exp) ((void)0)
|
||||
#endif
|
||||
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
|
||||
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
|
||||
|
||||
|
||||
typedef enum {
|
||||
REF_EXTERNAL = 0,
|
||||
REF_INTRINSIC = 1,
|
||||
REF_INTERNAL = 2
|
||||
|
||||
} REF_TYPE;
|
||||
/**
|
||||
* Defines the various types of surface formats.
|
||||
*/
|
||||
typedef enum _D3DFORMAT {
|
||||
D3DFMT_UNKNOWN = 0,
|
||||
|
||||
D3DFMT_R8G8B8 = 20,
|
||||
D3DFMT_A8R8G8B8 = 21,
|
||||
D3DFMT_X8R8G8B8 = 22,
|
||||
D3DFMT_R5G6B5 = 23,
|
||||
D3DFMT_X1R5G5B5 = 24,
|
||||
D3DFMT_A1R5G5B5 = 25,
|
||||
D3DFMT_A4R4G4B4 = 26,
|
||||
D3DFMT_R3G3B2 = 27,
|
||||
D3DFMT_A8 = 28,
|
||||
D3DFMT_A8R3G3B2 = 29,
|
||||
D3DFMT_X4R4G4B4 = 30,
|
||||
D3DFMT_A2B10G10R10 = 31,
|
||||
D3DFMT_A8B8G8R8 = 32,
|
||||
D3DFMT_X8B8G8R8 = 33,
|
||||
D3DFMT_G16R16 = 34,
|
||||
D3DFMT_A2R10G10B10 = 35,
|
||||
D3DFMT_A16B16G16R16 = 36,
|
||||
|
||||
D3DFMT_A8P8 = 40,
|
||||
D3DFMT_P8 = 41,
|
||||
|
||||
D3DFMT_L8 = 50,
|
||||
D3DFMT_A8L8 = 51,
|
||||
D3DFMT_A4L4 = 52,
|
||||
|
||||
D3DFMT_V8U8 = 60,
|
||||
D3DFMT_L6V5U5 = 61,
|
||||
D3DFMT_X8L8V8U8 = 62,
|
||||
D3DFMT_Q8W8V8U8 = 63,
|
||||
D3DFMT_V16U16 = 64,
|
||||
D3DFMT_A2W10V10U10 = 67,
|
||||
|
||||
D3DFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'),
|
||||
D3DFMT_R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'),
|
||||
D3DFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'),
|
||||
D3DFMT_G8R8_G8B8 = MAKEFOURCC('G', 'R', 'G', 'B'),
|
||||
D3DFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'),
|
||||
D3DFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'),
|
||||
D3DFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'),
|
||||
D3DFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'),
|
||||
D3DFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'),
|
||||
|
||||
D3DFMT_D16_LOCKABLE = 70,
|
||||
D3DFMT_D32 = 71,
|
||||
D3DFMT_D15S1 = 73,
|
||||
D3DFMT_D24S8 = 75,
|
||||
D3DFMT_D24X8 = 77,
|
||||
D3DFMT_D24X4S4 = 79,
|
||||
D3DFMT_D16 = 80,
|
||||
|
||||
D3DFMT_D32F_LOCKABLE = 82,
|
||||
D3DFMT_D24FS8 = 83,
|
||||
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
D3DFMT_D32_LOCKABLE = 84,
|
||||
D3DFMT_S8_LOCKABLE = 85,
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
|
||||
D3DFMT_L16 = 81,
|
||||
|
||||
D3DFMT_VERTEXDATA =100,
|
||||
D3DFMT_INDEX16 =101,
|
||||
D3DFMT_INDEX32 =102,
|
||||
|
||||
D3DFMT_Q16W16V16U16 =110,
|
||||
|
||||
D3DFMT_MULTI2_ARGB8 = MAKEFOURCC('M','E','T','1'),
|
||||
|
||||
D3DFMT_R16F = 111,
|
||||
D3DFMT_G16R16F = 112,
|
||||
D3DFMT_A16B16G16R16F = 113,
|
||||
|
||||
D3DFMT_R32F = 114,
|
||||
D3DFMT_G32R32F = 115,
|
||||
D3DFMT_A32B32G32R32F = 116,
|
||||
|
||||
D3DFMT_CxV8U8 = 117,
|
||||
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
D3DFMT_A1 = 118,
|
||||
D3DFMT_A2B10G10R10_XR_BIAS = 119,
|
||||
D3DFMT_BINARYBUFFER = 199,
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
|
||||
D3DFMT_FORCE_DWORD =0x7fffffff
|
||||
} D3DFORMAT;
|
||||
|
||||
/**
|
||||
* Defines the levels of full-scene multisampling that the device can apply.
|
||||
*/
|
||||
typedef enum D3DMULTISAMPLE_TYPE {
|
||||
D3DMULTISAMPLE_NONE = 0,
|
||||
D3DMULTISAMPLE_NONMASKABLE = 1,
|
||||
D3DMULTISAMPLE_2_SAMPLES = 2,
|
||||
D3DMULTISAMPLE_3_SAMPLES = 3,
|
||||
D3DMULTISAMPLE_4_SAMPLES = 4,
|
||||
D3DMULTISAMPLE_5_SAMPLES = 5,
|
||||
D3DMULTISAMPLE_6_SAMPLES = 6,
|
||||
D3DMULTISAMPLE_7_SAMPLES = 7,
|
||||
D3DMULTISAMPLE_8_SAMPLES = 8,
|
||||
D3DMULTISAMPLE_9_SAMPLES = 9,
|
||||
D3DMULTISAMPLE_10_SAMPLES = 10,
|
||||
D3DMULTISAMPLE_11_SAMPLES = 11,
|
||||
D3DMULTISAMPLE_12_SAMPLES = 12,
|
||||
D3DMULTISAMPLE_13_SAMPLES = 13,
|
||||
D3DMULTISAMPLE_14_SAMPLES = 14,
|
||||
D3DMULTISAMPLE_15_SAMPLES = 15,
|
||||
D3DMULTISAMPLE_16_SAMPLES = 16,
|
||||
D3DMULTISAMPLE_FORCE_DWORD = 0xffffffff
|
||||
} D3DMULTISAMPLE_TYPE, *LPD3DMULTISAMPLE_TYPE;
|
||||
|
||||
/**
|
||||
* Defines swap effects
|
||||
*/
|
||||
typedef enum D3DSWAPEFFECT {
|
||||
D3DSWAPEFFECT_DISCARD = 1,
|
||||
D3DSWAPEFFECT_FLIP = 2,
|
||||
D3DSWAPEFFECT_COPY = 3,
|
||||
D3DSWAPEFFECT_OVERLAY = 4,
|
||||
D3DSWAPEFFECT_FLIPEX = 5,
|
||||
D3DSWAPEFFECT_FORCE_DWORD = 0xFFFFFFFF
|
||||
} D3DSWAPEFFECT, *LPD3DSWAPEFFECT;
|
||||
|
||||
/**
|
||||
* Describes the presentation parameters.
|
||||
*/
|
||||
struct D3DPRESENT_PARAMETERS {
|
||||
UINT BackBufferWidth;
|
||||
UINT BackBufferHeight;
|
||||
D3DFORMAT BackBufferFormat;
|
||||
UINT BackBufferCount;
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType;
|
||||
DWORD MultiSampleQuality;
|
||||
D3DSWAPEFFECT SwapEffect;
|
||||
HWND hDeviceWindow;
|
||||
BOOL Windowed;
|
||||
BOOL EnableAutoDepthStencil;
|
||||
D3DFORMAT AutoDepthStencilFormat;
|
||||
DWORD Flags;
|
||||
UINT FullScreen_RefreshRateInHz;
|
||||
UINT PresentationInterval;
|
||||
};
|
||||
typedef struct D3DPRESENT_PARAMETERS D3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS;
|
||||
|
||||
struct IDirect3DDevice9 : public IUnknown {
|
||||
virtual HRESULT QueryInterface(REFIID riid, void** ppvObj);
|
||||
virtual ULONG AddRef();
|
||||
virtual ULONG Release();
|
||||
|
||||
// Define other methods required by IDirect3D9 interface
|
||||
};
|
||||
typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
|
||||
|
||||
/**
|
||||
* Defines device types
|
||||
*/
|
||||
typedef enum D3DDEVTYPE {
|
||||
D3DDEVTYPE_HAL = 1,
|
||||
D3DDEVTYPE_NULLREF = 4,
|
||||
D3DDEVTYPE_REF = 2,
|
||||
D3DDEVTYPE_SW = 3,
|
||||
D3DDEVTYPE_FORCE_DWORD = 0xffffffff
|
||||
} D3DDEVTYPE, *LPD3DDEVTYPE;
|
||||
|
||||
struct IDirect3D9 : public IUnknown {
|
||||
IDirect3D9(UINT SDKVersion);
|
||||
|
||||
HRESULT QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG AddRef();
|
||||
ULONG Release();
|
||||
|
||||
HRESULT CreateDevice(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
HWND hFocusWindow,
|
||||
DWORD BehaviorFlags,
|
||||
D3DPRESENT_PARAMETERS *pPresentationParameters,
|
||||
IDirect3DDevice9 **ppReturnedDeviceInterface
|
||||
);
|
||||
|
||||
private:
|
||||
DWORD m_cRef;
|
||||
|
||||
// Define other methods required by IDirect3D9 interface
|
||||
};
|
||||
typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9;
|
||||
IDirect3D9* Direct3DCreate9(UINT SDKVersion);
|
||||
|
||||
#endif
|
12
prod_include/objbase.h
Normal file
12
prod_include/objbase.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define STDMETHODCALLTYPE syscall(SYS_gettid);
|
||||
struct IID {
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
};
|
||||
typedef const IID* REFIID;
|
11
prod_include/unknwn.h
Normal file
11
prod_include/unknwn.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <winerror.h>
|
||||
#include <objbase.h>
|
||||
|
||||
struct IUnknown {
|
||||
virtual HRESULT QueryInterface (REFIID riid, void **ppvObject) = 0;
|
||||
virtual ULONG AddRef () = 0;
|
||||
virtual ULONG Release () = 0;
|
||||
};
|
10
prod_include/windef.h
Normal file
10
prod_include/windef.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#define WINAPI __stdcall
|
||||
#define HINSTANCE void*
|
||||
#define LPSTR char*
|
||||
#define LPCTSTR const char*
|
||||
#define HWND GtkWidget
|
||||
#define HMENU void*
|
||||
|
||||
#define DWORD unsigned long
|
39
prod_include/windows.h
Normal file
39
prod_include/windows.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This file only provides types for
|
||||
* Compatibility propourses regarding
|
||||
* OpenDX. It's not intended to rewrite
|
||||
* the entire Windows API.
|
||||
*
|
||||
* Part of: libopendx.so
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
//does it really goes here?
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define __stdcall __attribute__((stdcall))
|
||||
#endif
|
||||
|
||||
//windows types:
|
||||
#define WCHAR wchar_t
|
||||
#define TCHAR char
|
||||
#define UINT unsigned int
|
||||
#define ULONG unsigned long
|
||||
#define UlONG_PTR unsigned long
|
||||
#define LONG long
|
||||
#define BOOL bool
|
||||
#define BYTE unsigned char
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winnt.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define LPCTSTR const char*
|
||||
#define DWORD unsigned long
|
||||
#define HWND void*
|
||||
#define HMENU void*
|
||||
#define HINSTANCE void*
|
||||
#define LPVOID void*
|
4
prod_include/winerror.h
Normal file
4
prod_include/winerror.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
|
||||
#define HRESULT LONG
|
3
prod_include/winnt.h
Normal file
3
prod_include/winnt.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define LPVOID void*
|
3
run.sh
Executable file
3
run.sh
Executable file
@ -0,0 +1,3 @@
|
||||
# Run dxdiag from build directory
|
||||
cd build
|
||||
./dxdiag
|
12
tests/CMakeLists.txt
Normal file
12
tests/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
# This target is "sample" and it is an executable.
|
||||
# The executable is built from the source file "basic_window.cpp".
|
||||
|
||||
pkg_check_modules(GTK4 REQUIRED gtk4)
|
||||
|
||||
|
||||
include_directories(${GTK4_INCLUDE_DIRS})
|
||||
link_directories(${GTK4_LIBRARY_DIRS})
|
||||
|
||||
add_executable(sample basic_window.cpp)
|
||||
target_link_libraries(sample ${GTK4_LIBRARIES})
|
||||
target_link_libraries(sample d3d9)
|
66
tests/basic_window.cpp
Normal file
66
tests/basic_window.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Windows API codes were commented to focus
|
||||
* on what's important: OpenDX.
|
||||
*
|
||||
* Code that doesn't work is also commented.
|
||||
*/
|
||||
#include <d3d9.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
|
||||
// Create the window
|
||||
//HWND hWnd = CreateWindow("DX9 Window", "DX9 Window", 0, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
|
||||
|
||||
// Create the Direct3D device
|
||||
LPDIRECT3D9 pD3D = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
LPDIRECT3DDEVICE9 pDevice = NULL;
|
||||
D3DPRESENT_PARAMETERS pp;
|
||||
/*ZeroMemory(&pp, sizeof(pp));
|
||||
pp.Windowed = TRUE;
|
||||
pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, &pDevice);
|
||||
|
||||
// Enter the message loop
|
||||
MSG msg;
|
||||
ZeroMemory(&msg, sizeof(msg));
|
||||
while (msg.message != WM_QUIT) {
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else {
|
||||
// Render the scene
|
||||
pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);
|
||||
pDevice->BeginScene();
|
||||
pDevice->EndScene();
|
||||
pDevice->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up
|
||||
pDevice->Release();
|
||||
pD3D->Release();
|
||||
DestroyWindow(hWnd);
|
||||
return msg.wParam;*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Linux's main
|
||||
int main(int argc, char* argv[]) {
|
||||
char* cmdline = (char*) malloc(sizeof(char));
|
||||
cmdline[0] = '\0';
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
cmdline = (char*) realloc(cmdline, strlen(cmdline) + strlen(argv[i]) + 2);
|
||||
strcat(cmdline, argv[i]);
|
||||
if (i < argc - 1) {
|
||||
strcat(cmdline, " ");
|
||||
}
|
||||
}
|
||||
|
||||
return WinMain(nullptr, nullptr, cmdline, 0);
|
||||
}
|
9
tools/dxdiag/README.md
Normal file
9
tools/dxdiag/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# OpenDX - dxdiag
|
||||

|
||||
This is a sub-project of OpenDX. The Open Source alternative to Microsoft's DirectX SDK for Linux devices.
|
||||
|
||||
## Improvements over Microsoft's dxdiag
|
||||
* Fixes various bugs from the original dxdiag (e.g outdated date information, layout issues, etc.)
|
||||
* Uses native Linux APIs to gather information about the system.
|
||||
* Faster initialisation and execution
|
||||
* Compatible with GTK themes
|
7
tools/dxdiag/layout/MainWindow.hpp
Normal file
7
tools/dxdiag/layout/MainWindow.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <preprocessor/GetFileContent.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace MainWindow {
|
||||
const std::string ui = GetFileContent(PROJECT_SOURCE_DIR "/tools/dxdiag/layout/MainWindow.ui");
|
||||
}
|
400
tools/dxdiag/layout/MainWindow.ui
Normal file
400
tools/dxdiag/layout/MainWindow.ui
Normal file
@ -0,0 +1,400 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkWindow" id="main_window">
|
||||
<property name="default-width">720</property>
|
||||
<property name="default-height">480</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkNotebook">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="focusable">1</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1">This tool reports detailed information about the DirectX components and drivers installed on your system.
|
||||
|
||||
|
||||
If you know what area is causing the problem, click on the apropriate tab above. Otherwise, you can use the "Next Page" button below to visit each page in sequence.
|
||||
|
||||
</property>
|
||||
<property name="wrap">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="focusable">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkViewport">
|
||||
<property name="child">
|
||||
<object class="GtkGrid">
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="row-spacing">2</property>
|
||||
<property name="column-spacing">5</property>
|
||||
<property name="column-homogeneous">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Current Date/Time:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="date_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Nullsday, Nul 00, 0000, 0:00:00 AM</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Computer Name:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pc_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">null</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Operating System:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="os_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Nullbuntu 64-bit (23.04, kernel 0)</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Language:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lang_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Null (Regional Setting: Null)</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">System Manufacturer:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pcman_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Unknown</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">System Model:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pcmod_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Unknown</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">BIOS:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="bios_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Null (0)</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Processor:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="cpu_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">Intel(R) Celeron(TM) N0000 CPU @ 0GHz (0 CPUs), ~(0GHz)</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Memory:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">8</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="ram_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">0MB RAM</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">8</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">Page/Swap File:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">9</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="swap_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">0MB used, 0MB available</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">9</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">DirectX Version:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">10</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="dx_val">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">DirectX 0</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">10</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="1">OpenDX Version:</property>
|
||||
<property name="justify">right</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">11</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="1">0.0.0 (About the OpenDX Project)</property>
|
||||
<property name="use-markup">1</property>
|
||||
<property name="selectable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">11</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1">System Information</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1" context="tab_system">System</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="1" context="help">Help</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkOverlay">
|
||||
<property name="hexpand">1</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="1" context="next_page">Next Page</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="1" context="save_all_information">Save All Information...</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="1" context="exit">Exit</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</interface>
|
45
tools/dxdiag/locale/en_US.hpp
Normal file
45
tools/dxdiag/locale/en_US.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <types/Translation.hpp>
|
||||
|
||||
/**
|
||||
* TODO Complete with @see /include/types/Translation.hpp
|
||||
*/
|
||||
Translation_t Translation_enUS() {
|
||||
Translation_t r;
|
||||
|
||||
//Common texts
|
||||
r.yes = (char*) "Yes";
|
||||
r.no = (char*) "No";
|
||||
r.not_available = (char*) "Not Available";
|
||||
r.enabled = (char*) "Enabled";
|
||||
|
||||
//Tab names
|
||||
r.tab_system = (char*) "System";
|
||||
r.tab_display = (char*) "Display";
|
||||
r.tab_sound = (char*) "Sound";
|
||||
r.tab_input = (char*) "Input";
|
||||
|
||||
//Buttons
|
||||
r.btn_help = (char*) "Help";
|
||||
r.btn_next = (char*) "Next";
|
||||
r.btn_save = (char*) "Save";
|
||||
r.btn_exit = (char*) "Exit";
|
||||
|
||||
//Tab System
|
||||
r.system_description = (char*) "This tool reports detailed information about the OpenDX components and drivers installed on your system.\n\nIf you know what area is causing the problem, click on the apropriate tab above. Otherwise, you can yse the \"Next Page\" button below to visit each page in sequence.";
|
||||
r.system_info_label = (char*) "System Information";
|
||||
r.system_info_currentDate = (char*) "Current Date/Time";
|
||||
r.system_info_pcName = (char*) "Computer Name";
|
||||
r.system_info_os = (char*) "Operating System";
|
||||
r.system_info_language = (char*) "Language";
|
||||
r.system_info_manufacturer = (char*) "System Manufacturer";
|
||||
r.system_info_model = (char*) "System Model";
|
||||
r.system_info_bios = (char*) "BIOS";
|
||||
r.system_info_processor = (char*) "Processor";
|
||||
r.system_info_memory = (char*) "Memory";
|
||||
r.system_info_pageFile = (char*) "Page file";
|
||||
r.system_info_directxVersion = (char*) "DirectX Version";
|
||||
r.system_info_opendxVersion = (char*) "OpenDX Version";
|
||||
|
||||
return r;
|
||||
}
|
15
tools/dxdiag/locale/pt_BR.hpp
Normal file
15
tools/dxdiag/locale/pt_BR.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <types/Translation.hpp>
|
||||
#include "en_US.hpp"
|
||||
|
||||
/**
|
||||
* TODO Completar
|
||||
*/
|
||||
Translation_t Translation_ptBR() {
|
||||
Translation_t r = Translation_enUS();
|
||||
|
||||
//Common texts
|
||||
r.yes = (char*) "Sim";
|
||||
|
||||
return r;
|
||||
}
|
34
tools/dxdiag/main.cpp
Normal file
34
tools/dxdiag/main.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <config.hpp>
|
||||
#include <iostream>
|
||||
#include <gtk/gtk.h> //GTK4
|
||||
#include "layout/MainWindow.hpp"
|
||||
#include "src/SystemTab.hpp"
|
||||
|
||||
//DirectX files:
|
||||
#include <d3d9.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if DEBUG
|
||||
printf("Application started!\n\n");
|
||||
#endif
|
||||
|
||||
//initializes GTK screen
|
||||
gtk_init();
|
||||
const gchar* glade_string = MainWindow::ui.c_str();
|
||||
GtkBuilder* builder = gtk_builder_new_from_string(glade_string, -1);
|
||||
GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "main_window"));
|
||||
|
||||
//setup events and show the screen:
|
||||
SystemTab::setup(builder);
|
||||
gtk_widget_show(GTK_WIDGET(window));
|
||||
|
||||
while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
g_object_unref(builder);
|
||||
|
||||
return 0;
|
||||
}
|
320
tools/dxdiag/src/SystemTab.hpp
Normal file
320
tools/dxdiag/src/SystemTab.hpp
Normal file
@ -0,0 +1,320 @@
|
||||
#pragma once
|
||||
#include <gtk/gtk.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
namespace SystemTab {
|
||||
/**
|
||||
* Set the text from "date_val"to the actual date/time.
|
||||
*/
|
||||
gboolean updateTime(GtkLabel* label) {
|
||||
time_t t = time(NULL);
|
||||
struct tm *time = localtime(&t);
|
||||
gchar str_time[40];
|
||||
|
||||
strftime(str_time, sizeof(str_time), "%A, %b %d, %Y, %I:%M:%S %p", time);
|
||||
gtk_label_set_text(label, str_time);
|
||||
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* set a timeout event every 500ms to set the actual date/time
|
||||
*/
|
||||
gboolean onRealizeTime(GtkLabel* label) {
|
||||
std::cout << "SystemTab::onRealizeTime()\n";
|
||||
|
||||
g_timeout_add (500, (GSourceFunc) SystemTab::updateTime, label);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text from "pc_val" to the unix hostname.
|
||||
*/
|
||||
gboolean setHostname(GtkLabel* label) {
|
||||
char hostname[1024];
|
||||
gethostname(hostname, sizeof hostname);
|
||||
|
||||
|
||||
gtk_label_set_text(label, hostname);
|
||||
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::string exec(const char* cmd) {
|
||||
std::vector<char> buffer(1024);
|
||||
std::string result;
|
||||
FILE* pipe = popen(cmd, "r");
|
||||
|
||||
if (!pipe) throw std::runtime_error("popen() failed!");
|
||||
|
||||
while (fgets(buffer.data(), buffer.size(), pipe) != nullptr) {
|
||||
result += buffer.data();
|
||||
}
|
||||
|
||||
pclose(pipe);
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean setOperatingSystem(GtkLabel* label) {
|
||||
std::string distro = exec("lsb_release -i | awk '{print $3}'");
|
||||
std::string distro_version = exec("lsb_release -r | awk '{print $2}'");
|
||||
std::string kernel_version = exec("uname -r");
|
||||
std::string arch = exec("uname -m | grep -q 64 && echo 64-bit || echo 32-bit");
|
||||
|
||||
// Trim the string values
|
||||
//distro.erase(std::remove(distro.begin(), distro.c_str() '\n'), distro.end());
|
||||
//distro_version.erase(std::remove(distro_version.begin(), distro_version.end(), '\n'), distro_version.end());
|
||||
//kernel_version.erase(std::remove(kernel_version.begin(), kernel_version.end(), '\n'), kernel_version.end());
|
||||
//arch.erase(std::remove(arch.begin(), arch.end(), '\n'), arch.end());
|
||||
|
||||
std::string os_info = distro + " " + arch + " (" + distro_version + ", kernel " + kernel_version + ")";
|
||||
|
||||
// Convert the string to const gchar*
|
||||
const gchar* text = os_info.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean setLanguage(GtkLabel* label) {
|
||||
char buffer[128];
|
||||
std::string lang, region;
|
||||
|
||||
// Get the LC_MESSAGES locale
|
||||
std::FILE* fp = popen("locale | grep LC_MESSAGES | cut -d= -f2 | cut -d_ -f1", "r");
|
||||
std::fgets(buffer, 128, fp);
|
||||
lang = buffer;
|
||||
pclose(fp);
|
||||
|
||||
// Get the LC_CTYPE locale
|
||||
fp = popen("locale | grep LC_CTYPE | cut -d= -f2 | cut -d_ -f2", "r");
|
||||
std::fgets(buffer, 128, fp);
|
||||
region = buffer;
|
||||
pclose(fp);
|
||||
|
||||
// Remove newline characters
|
||||
lang.erase(lang.size() - 1, 1);
|
||||
region.erase(region.size() - 1, 1);
|
||||
|
||||
// Return the formatted string
|
||||
std::string str = lang + " (Regional Setting: " + region + ")";
|
||||
const gchar* text = str.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean setManufacturer(GtkLabel* label) {
|
||||
std::ifstream file("/sys/class/dmi/id/sys_vendor");
|
||||
std::string manufacturer;
|
||||
|
||||
if (file.is_open()) {
|
||||
std::getline(file, manufacturer);
|
||||
}
|
||||
|
||||
const gchar* text = manufacturer.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean setModel(GtkLabel* label) {
|
||||
std::ifstream file("/sys/class/dmi/id/product_name");
|
||||
std::string model;
|
||||
|
||||
if (file.is_open()) {
|
||||
std::getline(file, model);
|
||||
}
|
||||
|
||||
const gchar* text = model.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean setBIOS(GtkLabel* label) {
|
||||
std::ifstream file("/sys/class/dmi/id/bios_version");
|
||||
std::string bios;
|
||||
|
||||
if (file.is_open()) {
|
||||
std::getline(file, bios);
|
||||
}
|
||||
|
||||
const gchar* text = bios.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::string getCpuModelName() {
|
||||
std::ifstream file("/proc/cpuinfo");
|
||||
std::string line;
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
if (line.find("model name") != std::string::npos) {
|
||||
return line.substr(line.find(":") + 2);
|
||||
}
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
int getCpuCoreCount() {
|
||||
std::ifstream file("/proc/cpuinfo");
|
||||
std::string line;
|
||||
int core_count = 0;
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
if (line.find("processor") != std::string::npos) {
|
||||
++core_count;
|
||||
}
|
||||
}
|
||||
|
||||
return core_count;
|
||||
}
|
||||
|
||||
double getCpuFrequency() {
|
||||
std::ifstream file("/proc/cpuinfo");
|
||||
std::string line;
|
||||
double frequency = 0.0;
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
if (line.find("cpu MHz") != std::string::npos) {
|
||||
frequency += std::stod(line.substr(line.find(":") + 1));
|
||||
}
|
||||
}
|
||||
|
||||
return frequency;
|
||||
}
|
||||
|
||||
std::string getCpuInfo() {
|
||||
int core_count = getCpuCoreCount();
|
||||
double frequency = getCpuFrequency() / 1000;
|
||||
std::string model_name = getCpuModelName();
|
||||
|
||||
std::ostringstream frequency_stream;
|
||||
frequency_stream << std::fixed << std::setprecision(2) << frequency / core_count;
|
||||
std::string formatted_frequency = frequency_stream.str();
|
||||
|
||||
return model_name + " (" + std::to_string(core_count) + " CPUs), ~" + formatted_frequency + "GHz";
|
||||
}
|
||||
|
||||
gboolean setCPU(GtkLabel* label) {
|
||||
std::string cpu = SystemTab::getCpuInfo();
|
||||
const gchar* text = cpu.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean setRAM(GtkLabel* label) {
|
||||
std::ifstream file("/proc/meminfo");
|
||||
std::string line;
|
||||
std::string ram = "0MB RAM";
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
if (line.find("MemTotal") != std::string::npos) {
|
||||
int mb = std::stoi(line.substr(line.find(":") + 1)) / 1024;
|
||||
ram = std::to_string(mb) + "MB RAM";
|
||||
}
|
||||
}
|
||||
|
||||
const gchar* text = ram.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean updateSwap(GtkLabel* label) {
|
||||
|
||||
struct sysinfo info;
|
||||
sysinfo(&info);
|
||||
|
||||
const int used = (info.totalswap - info.freeswap) / (1024 * 1024);
|
||||
const int available = info.freeswap / (1024 * 1024);
|
||||
std::string swap = std::to_string(used) + "MB used, " + std::to_string(available) + "MB available";
|
||||
|
||||
const gchar* text = swap.c_str();
|
||||
|
||||
gtk_label_set_text(label, text);
|
||||
gtk_widget_queue_draw(GTK_WIDGET(label));
|
||||
gtk_widget_queue_draw(gtk_widget_get_parent(GTK_WIDGET(label)));
|
||||
gtk_widget_show(GTK_WIDGET(label));
|
||||
}
|
||||
|
||||
gboolean setSwap(GtkLabel* label) {
|
||||
g_timeout_add (500, (GSourceFunc) SystemTab::updateSwap, label);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup IDs and it's events
|
||||
*/
|
||||
void setup(GtkBuilder* builder) {
|
||||
std::cout << "SystemTab::setup()\n";
|
||||
|
||||
GtkLabel* date_val = GTK_LABEL(gtk_builder_get_object(builder, "date_val"));
|
||||
g_signal_connect (date_val, "realize", G_CALLBACK (SystemTab::onRealizeTime), NULL);
|
||||
GtkLabel* pc_val = GTK_LABEL(gtk_builder_get_object(builder, "pc_val"));
|
||||
g_signal_connect (pc_val, "realize", G_CALLBACK (SystemTab::setHostname), NULL);
|
||||
GtkLabel* os_val = GTK_LABEL(gtk_builder_get_object(builder, "os_val"));
|
||||
g_signal_connect (os_val, "realize", G_CALLBACK (SystemTab::setOperatingSystem), NULL);
|
||||
GtkLabel* lang_val = GTK_LABEL(gtk_builder_get_object(builder, "lang_val"));
|
||||
g_signal_connect (lang_val, "realize", G_CALLBACK (SystemTab::setLanguage), NULL);
|
||||
GtkLabel* pcman_val = GTK_LABEL(gtk_builder_get_object(builder, "pcman_val"));
|
||||
g_signal_connect (pcman_val, "realize", G_CALLBACK (SystemTab::setManufacturer), NULL);
|
||||
GtkLabel* pcmod_val = GTK_LABEL(gtk_builder_get_object(builder, "pcmod_val"));
|
||||
g_signal_connect (pcmod_val, "realize", G_CALLBACK (SystemTab::setModel), NULL);
|
||||
GtkLabel* bios_val = GTK_LABEL(gtk_builder_get_object(builder, "bios_val"));
|
||||
g_signal_connect (bios_val, "realize", G_CALLBACK (SystemTab::setBIOS), NULL);
|
||||
GtkLabel* cpu_val = GTK_LABEL(gtk_builder_get_object(builder, "cpu_val"));
|
||||
g_signal_connect (cpu_val, "realize", G_CALLBACK (SystemTab::setCPU), NULL);
|
||||
GtkLabel* ram_val = GTK_LABEL(gtk_builder_get_object(builder, "ram_val"));
|
||||
g_signal_connect (ram_val, "realize", G_CALLBACK (SystemTab::setRAM), NULL);
|
||||
GtkLabel* swap_val = GTK_LABEL(gtk_builder_get_object(builder, "swap_val"));
|
||||
g_signal_connect (swap_val, "realize", G_CALLBACK (SystemTab::setSwap), NULL);
|
||||
}
|
||||
}
|
BIN
tools/dxdiag/src/utils/.DXUtils.hpp.kate-swp
Normal file
BIN
tools/dxdiag/src/utils/.DXUtils.hpp.kate-swp
Normal file
Binary file not shown.
8
tools/dxdiag/src/utils/DXUtils.hpp
Normal file
8
tools/dxdiag/src/utils/DXUtils.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
|
||||
namespace DXUtils {
|
||||
char* getDirectXVersion() {
|
||||
// TODO: check for direct x version somehow.
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user