hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
946eb5b09957fa538cd6af6ac65a4470202796d3
1,869
hpp
C++
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
1
2018-01-19T00:29:49.000Z
2018-01-19T00:29:49.000Z
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
4
2020-12-18T10:06:16.000Z
2020-12-18T10:09:25.000Z
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
null
null
null
/* * The MIT License (MIT) * * Copyright (c) 2017 Lev Sizov * * 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. */ /*! * \file RAII.hpp * \brief RAII pattern interface * \author Lev Sizov * \date 28.05.17 * * This file contains RAII class which plays as interface for RAII pattern. */ #ifndef VULKALC_RAII_H #define VULKALC_RAII_H #include "Export.hpp" /*! * \copydoc Application */ namespace Vulkalc { /*! * \brief RAII class which plays as interface for RAII pattern * * Abstract class RAII, which plays as interface to implement RAII pattern */ class VULKALC_API RAII { protected: /*! * \brief Initializes a resource */ virtual void init() = 0; /*! * \brief Releases a resource */ virtual void release() = 0; }; } #endif //VULKALC_RAII_H
28.753846
80
0.702515
whyamiroot
946fd1b61af12a89a1c68896aea9425c55592921
3,109
cpp
C++
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
/*____________________________________________________________________________________ Contact Management System trie.cpp - Trie data structure class definition file. - Akshay Mohan MIT License Copyright (c) 2019 Akshay Mohan 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. ____________________________________________________________________________________*/ #include "trie.h" Trie::Trie() { this->root = new Node(); } Node* Trie::insert(std::string key) { Node *temp = this->root; for(auto c : key) { if(temp->children.find(c) == temp->children.end()) temp->children[c] = new Node(); temp = temp->children[c]; } temp->end_of_word = true; return temp; } Node* Trie::search(Node *root, std::string key, bool *result) { for(auto c : key) { if(root->children.find(c) == root->children.end()) { *result = false; return nullptr; } root = root->children[c]; } *result = (root->end_of_word) ? true : false; return root; } Node* Trie::search(std::string key, bool *result) { return search(this->root, key, result); } bool Trie::exists(std::string key) { bool result; search(this->root, key, &result); return result; } bool Trie::remove(Node *root, char *key) { if(root == nullptr) return false; if(*key == '\0') { if(!root->end_of_word) return false; else root->end_of_word = false; } else { if((root->children.find(*key) == root->children.end()) || !remove(root->children[*key], key + 1)) return false; } if(root->children.empty()) delete root; return true; } bool Trie::remove(char *key) { return remove(this->root, key); } #ifdef _TRIE_DEBUG_MODE_ void Trie::display(Node *root, char *buffer, unsigned int idx) { if(root->end_of_word) { buffer[idx] = '\0'; std::cout << buffer << std::endl; } for(auto i : root->children) { buffer[idx] = i.first; display(i.second, buffer, idx + 1); } } void Trie::display() { char buffer[32]; display(this->root, buffer, 0); } #endif
24.480315
100
0.675137
AkshayMohan
20e1ccc95c27380a715dcc4d587d9309fa62ee06
3,489
cpp
C++
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
1
2022-02-01T18:04:45.000Z
2022-02-01T18:04:45.000Z
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
null
null
null
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
1
2018-12-30T00:49:36.000Z
2018-12-30T00:49:36.000Z
#include "levelset_util.h" //Given two signed distance values (line endpoints), determine what fraction of a connecting segment is "inside" float fraction_inside(float phi_left, float phi_right) { if(phi_left < 0 && phi_right < 0) return 1; if (phi_left < 0 && phi_right >= 0) return phi_left / (phi_left - phi_right); if(phi_left >= 0 && phi_right < 0) return phi_right / (phi_right - phi_left); else return 0; } static void cycle_array(float* arr, int size) { float t = arr[0]; for(int i = 0; i < size-1; ++i) arr[i] = arr[i+1]; arr[size-1] = t; } //Given four signed distance values (square corners), determine what fraction of the square is "inside" float fraction_inside(float phi_bl, float phi_br, float phi_tl, float phi_tr) { int inside_count = (phi_bl<0?1:0) + (phi_tl<0?1:0) + (phi_br<0?1:0) + (phi_tr<0?1:0); float list[] = { phi_bl, phi_br, phi_tr, phi_tl }; if(inside_count == 4) return 1; else if (inside_count == 3) { //rotate until the positive value is in the first position while(list[0] < 0) { cycle_array(list,4); } //Work out the area of the exterior triangle float side0 = 1-fraction_inside(list[0], list[3]); float side1 = 1-fraction_inside(list[0], list[1]); return 1 - 0.5f*side0*side1; } else if(inside_count == 2) { //rotate until a negative value is in the first position, and the next negative is in either slot 1 or 2. while(list[0] >= 0 || !(list[1] < 0 || list[2] < 0)) { cycle_array(list,4); } if(list[1] < 0) { //the matching signs are adjacent float side_left = fraction_inside(list[0], list[3]); float side_right = fraction_inside(list[1], list[2]); return 0.5f*(side_left + side_right); } else { //matching signs are diagonally opposite //determine the centre point's sign to disambiguate this case float middle_point = 0.25f*(list[0] + list[1] + list[2] + list[3]); if(middle_point < 0) { float area = 0; //first triangle (top left) float side1 = 1-fraction_inside(list[0], list[3]); float side3 = 1-fraction_inside(list[2], list[3]); area += 0.5f*side1*side3; //second triangle (top right) float side2 = 1-fraction_inside(list[2], list[1]); float side0 = 1-fraction_inside(list[0], list[1]); area += 0.5f*side0*side2; return 1-area; } else { float area = 0; //first triangle (bottom left) float side0 = fraction_inside(list[0], list[1]); float side1 = fraction_inside(list[0], list[3]); area += 0.5f*side0*side1; //second triangle (top right) float side2 = fraction_inside(list[2], list[1]); float side3 = fraction_inside(list[2], list[3]); area += 0.5f*side2*side3; return area; } } } else if(inside_count == 1) { //rotate until the negative value is in the first position while(list[0] >= 0) { cycle_array(list,4); } //Work out the area of the interior triangle, and subtract from 1. float side0 = fraction_inside(list[0], list[3]); float side1 = fraction_inside(list[0], list[1]); return 0.5f*side0*side1; } else return 0; }
33.548077
112
0.57495
OrionQuest
20e29f2b5cae32bdfa088f94e170950d54f0719d
590
cpp
C++
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; #define ll long long int int main(){ ios::sync_with_stdio(0); cin.tie(0); string s; getline(cin,s); set<char>k; for(int i=0;i<s.length();i++){ if(s[i]=='a'||s[i]=='b'||s[i]=='c'||s[i]=='d'||s[i]=='e'||s[i]=='f'||s[i]=='g'||s[i]=='h'||s[i]=='i'||s[i]=='j'||s[i]=='k'||s[i]=='l'||s[i]=='m'||s[i]=='n'||s[i]=='o'||s[i]=='p'||s[i]=='q'||s[i]=='r'||s[i]=='s'||s[i]=='u'||s[i]=='v'||s[i]=='w'||s[i]=='x'||s[i]=='y'||s[i]=='z'||s[i]=='t'){ k.insert(s[i]); } } cout<<k.size(); return 0; }
32.777778
297
0.394915
amit9amarwanshi
20e39a1800584a041a68aba2a289e213fafd4d70
88,719
cpp
C++
Hacks/Esp.cpp
DanielBence/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
2
2020-06-18T11:07:55.000Z
2020-07-14T15:16:24.000Z
Hacks/Esp.cpp
DanielAtom/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
null
null
null
Hacks/Esp.cpp
DanielAtom/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
1
2020-11-04T07:15:30.000Z
2020-11-04T07:15:30.000Z
#define NOMINMAX #include <sstream> #include "Esp.h" #include "../Config.h" #include "../Interfaces.h" #include "../Memory.h" #include "../SDK/ConVar.h" #include "../SDK/Entity.h" #include "../SDK/GlobalVars.h" #include "../SDK/Localize.h" #include "../SDK/Surface.h" #include "../SDK/Vector.h" #include "../SDK/WeaponData.h" bool canHear(LocalPlayer& local, Entity& target) noexcept { bool x = target.velocity().length2D() > 110.0f; bool z = target.getShotsFired() >= 1; //bool y = isInRange(&target, 25.4f); bool y = (target.getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f <= 25.4f; bool smk = target.isVisible(); bool line = memory->lineGoesThroughSmoke(local->getEyePosition(), target.getBonePosition(8), 1); //return (x || z || smk) && (y || smk); return (x || z || (smk && !line)) && (y || (smk && !line)); } static constexpr bool worldToScreen(const Vector& in, Vector& out) noexcept { const auto& matrix = interfaces->engine->worldToScreenMatrix(); float w = matrix._41 * in.x + matrix._42 * in.y + matrix._43 * in.z + matrix._44; if (w > 0.001f) { const auto [width, height] = interfaces->surface->getScreenSize(); out.x = width / 2 * (1 + (matrix._11 * in.x + matrix._12 * in.y + matrix._13 * in.z + matrix._14) / w); out.y = height / 2 * (1 - (matrix._21 * in.x + matrix._22 * in.y + matrix._23 * in.z + matrix._24) / w); out.z = 0.0f; return true; } return false; } static void renderSnaplines(Entity* entity, const Config::Esp::Shared& config) noexcept { if (!config.snaplines.enabled) return; Vector position; if (!worldToScreen(entity->getAbsOrigin(), position)) return; if (config.snaplines.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.snaplines.rainbowSpeed)); else interfaces->surface->setDrawColor(config.snaplines.color); const auto [width, height] = interfaces->surface->getScreenSize(); interfaces->surface->drawLine(width / 2, height, static_cast<int>(position.x), static_cast<int>(position.y)); } static void renderEyeTraces(Entity* entity, const Config::Esp::Player& config) noexcept { if (config.eyeTraces.enabled) { constexpr float maxRange{ 8192.0f }; auto eyeAngles = entity->eyeAngles(); Vector viewAngles{ cos(degreesToRadians(eyeAngles.x)) * cos(degreesToRadians(eyeAngles.y)) * maxRange, cos(degreesToRadians(eyeAngles.x)) * sin(degreesToRadians(eyeAngles.y)) * maxRange, -sin(degreesToRadians(eyeAngles.x)) * maxRange }; static Trace trace; Vector headPosition{ entity->getBonePosition(8) }; interfaces->engineTrace->traceRay({ headPosition, headPosition + viewAngles }, 0x46004009, { entity }, trace); Vector start, end; if (worldToScreen(trace.startpos, start) && worldToScreen(trace.endpos, end)) { if (config.eyeTraces.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.eyeTraces.rainbowSpeed)); else interfaces->surface->setDrawColor(config.eyeTraces.color); interfaces->surface->drawLine(start.x, start.y, end.x, end.y); } } } static constexpr void renderPositionedText(unsigned font, const wchar_t* text, std::pair<float, float&> position) noexcept { interfaces->surface->setTextFont(font); interfaces->surface->setTextPosition(position.first, position.second); position.second += interfaces->surface->getTextSize(font, text).second; interfaces->surface->printText(text); } struct BoundingBox { float x0, y0; float x1, y1; Vector vertices[8]; BoundingBox(Entity* entity) noexcept { const auto [width, height] = interfaces->surface->getScreenSize(); x0 = static_cast<float>(width * 2); y0 = static_cast<float>(height * 2); x1 = -x0; y1 = -y0; const auto& mins = entity->getCollideable()->obbMins(); const auto& maxs = entity->getCollideable()->obbMaxs(); for (int i = 0; i < 8; ++i) { const Vector point{ i & 1 ? maxs.x : mins.x, i & 2 ? maxs.y : mins.y, i & 4 ? maxs.z : mins.z }; if (!worldToScreen(point.transform(entity->coordinateFrame()), vertices[i])) { valid = false; return; } x0 = std::min(x0, vertices[i].x); y0 = std::min(y0, vertices[i].y); x1 = std::max(x1, vertices[i].x); y1 = std::max(y1, vertices[i].y); } valid = true; } operator bool() noexcept { return valid; } private: bool valid; }; static void renderBox(const BoundingBox& bbox, const Config::Esp::Shared& config) noexcept { if (config.box.enabled) { if (config.box.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.box.rainbowSpeed)); else interfaces->surface->setDrawColor(config.box.color); switch (config.boxType) { case 0: interfaces->surface->drawOutlinedRect(bbox.x0, bbox.y0, bbox.x1, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(bbox.x0 + 1, bbox.y0 + 1, bbox.x1 - 1, bbox.y1 - 1); interfaces->surface->drawOutlinedRect(bbox.x0 - 1, bbox.y0 - 1, bbox.x1 + 1, bbox.y1 + 1); } break; case 1: interfaces->surface->drawLine(bbox.x0, bbox.y0, bbox.x0, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y0, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0); interfaces->surface->drawLine(bbox.x1, bbox.y0, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0); interfaces->surface->drawLine(bbox.x1, bbox.y0, bbox.x1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y1, bbox.x0, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1); interfaces->surface->drawLine(bbox.x1, bbox.y1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1); interfaces->surface->drawLine(bbox.x1, bbox.y1, bbox.x1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); // TODO: get rid of fabsf() interfaces->surface->drawLine(bbox.x0 - 1, bbox.y0 - 1, bbox.x0 - 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y0 - 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 - 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y0 - 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 - 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y0 - 1, bbox.x1 + 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y1 + 1, bbox.x0 - 1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y1 + 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 + 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y1 + 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 + 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y1 + 1, bbox.x1 + 1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y0 + 1, bbox.x0 + 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 2, bbox.y0 + 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 + 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y0 + 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, (bbox.y0 + 1)); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y0 + 1, bbox.x1 - 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y1 - 1, bbox.x0 + 1, (bbox.y1) - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y1 - 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 - 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y1 - 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 - 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y1 - 2, (bbox.x1 - 1), (bbox.y1 - 1) - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0, bbox.x0 + 2, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x1 + 1, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0, bbox.x1 - 2, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x0 - 1, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0, bbox.x0 + 2, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x1 + 1, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0, bbox.x1 - 2, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y0 + 1, fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y0 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y1 + 1, fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y1 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y0 + 1, fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y0 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y1 + 1, fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y1 - 2); } break; case 2: for (int i = 0; i < 8; i++) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) interfaces->surface->drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i + j].x, bbox.vertices[i + j].y); } } break; case 3: for (int i = 0; i < 8; i++) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) { interfaces->surface->drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i].x + (bbox.vertices[i + j].x - bbox.vertices[i].x) * 0.25f, bbox.vertices[i].y + (bbox.vertices[i + j].y - bbox.vertices[i].y) * 0.25f); interfaces->surface->drawLine(bbox.vertices[i].x + (bbox.vertices[i + j].x - bbox.vertices[i].x) * 0.75f, bbox.vertices[i].y + (bbox.vertices[i + j].y - bbox.vertices[i].y) * 0.75f, bbox.vertices[i + j].x, bbox.vertices[i + j].y); } } } break; } } } static void renderPlayerBox(Entity* entity, const Config::Esp::Player& config) noexcept { if (BoundingBox bbox{ entity }) { renderBox(bbox, config); float drawPositionX = bbox.x0 - 5; if (config.healthBar.enabled) { static auto gameType{ interfaces->cvar->findVar("game_type") }; static auto survivalMaxHealth{ interfaces->cvar->findVar("sv_dz_player_max_health") }; const auto maxHealth{ (std::max)((gameType->getInt() == 6 ? survivalMaxHealth->getInt() : 100), entity->health()) }; if (config.healthBar.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.healthBar.rainbowSpeed)); else { int health = entity->health(); if (health > 0 && health <= 20) { interfaces->surface->setDrawColor(255, 0, 0); } else if (health > 20 && health <= 40) { interfaces->surface->setDrawColor(218, 182, 0); } else if (health > 40 && health <= 60) { interfaces->surface->setDrawColor(233, 215, 0); } else if (health > 60 && health <= 80) { interfaces->surface->setDrawColor(255, 199, 54); } else if (health > 80) { interfaces->surface->setDrawColor(0, 255, 131); } } interfaces->surface->drawFilledRect(drawPositionX - 3, bbox.y0 + abs(bbox.y1 - bbox.y0) * (maxHealth - entity->health()) / static_cast<float>(maxHealth), drawPositionX, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(drawPositionX - 4, bbox.y0 - 1, drawPositionX + 1, bbox.y1 + 1); } drawPositionX -= 7; } if (config.armorBar.enabled) { if (config.armorBar.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.armorBar.rainbowSpeed)); else interfaces->surface->setDrawColor(config.armorBar.color); interfaces->surface->drawFilledRect(drawPositionX - 3, bbox.y0 + abs(bbox.y1 - bbox.y0) * (100.0f - entity->armor()) / 100.0f, drawPositionX, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(drawPositionX - 4, bbox.y0 - 1, drawPositionX + 1, bbox.y1 + 1); } drawPositionX -= 7; } if (config.name.enabled) { if (PlayerInfo playerInfo; interfaces->engine->getPlayerInfo(entity->index(), playerInfo)) { if (wchar_t name[128]; MultiByteToWideChar(CP_UTF8, 0, playerInfo.name, -1, name, 128)) { const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y0 - 5 - height); interfaces->surface->printText(name); } } } if (const auto activeWeapon{ entity->getActiveWeapon() }; config.activeWeapon.enabled && activeWeapon) { const auto name{ interfaces->localize->find(activeWeapon->getWeaponData()->name) }; const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.activeWeapon.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.activeWeapon.rainbowSpeed)); else interfaces->surface->setTextColor(config.activeWeapon.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (config.health.enabled) { if (config.health.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.health.rainbowSpeed)); else interfaces->surface->setTextColor(config.health.color); renderPositionedText(config.font, (std::to_wstring(entity->health()) + L" HP").c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.armor.enabled) { if (config.armor.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.armor.rainbowSpeed)); else interfaces->surface->setTextColor(config.armor.color); renderPositionedText(config.font, (std::to_wstring(entity->armor()) + L" AR").c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.money.enabled) { if (config.money.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.money.rainbowSpeed)); else interfaces->surface->setTextColor(config.money.color); renderPositionedText(config.font, (L'$' + std::to_wstring(entity->account())).c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.distance.enabled && localPlayer) { if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } } } static void renderWeaponBox(Entity* entity, const Config::Esp::Weapon& config) noexcept { BoundingBox bbox{ entity }; if (!bbox) return; renderBox(bbox, config); if (config.name.enabled) { const auto name{ interfaces->localize->find(entity->getWeaponData()->name) }; const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (!localPlayer || !config.distance.enabled) return; if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } static void renderEntityBox(Entity* entity, const Config::Esp::Shared& config, const wchar_t* name) noexcept { if (BoundingBox bbox{ entity }) { renderBox(bbox, config); if (config.name.enabled) { const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (!localPlayer || !config.distance.enabled) return; if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } } static void renderHeadDot(Entity* entity, const Config::Esp::Player& config) noexcept { if (!config.headDot.enabled) return; if (!localPlayer) return; Vector head; if (!worldToScreen(entity->getBonePosition(8), head)) return; if (config.headDot.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.headDot.rainbowSpeed)); else interfaces->surface->setDrawColor(config.headDot.color); interfaces->surface->drawCircle(head.x, head.y, 0, static_cast<int>(100 / std::sqrt((localPlayer->getAbsOrigin() - entity->getAbsOrigin()).length()))); } enum EspId { ALLIES_ALL = 0, ALLIES_VISIBLE, ALLIES_OCCLUDED, ENEMIES_ALL, ENEMIES_VISIBLE, ENEMIES_OCCLUDED }; static bool isInRange(Entity* entity, float maxDistance) noexcept { if (!localPlayer) return false; return maxDistance == 0.0f || (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f <= maxDistance; } static constexpr bool renderPlayerEsp(Entity* entity, EspId id) noexcept { if (localPlayer && (config->esp.players[id].enabled || config->esp.players[id].deadesp && !localPlayer->isAlive()) && isInRange(entity, config->esp.players[id].maxDistance) && (!config->esp.players[id].soundEsp || (config->esp.players[id].soundEsp && canHear(localPlayer, *entity)))) { renderSnaplines(entity, config->esp.players[id]); renderEyeTraces(entity, config->esp.players[id]); renderPlayerBox(entity, config->esp.players[id]); renderHeadDot(entity, config->esp.players[id]); } return config->esp.players[id].enabled; } static void renderWeaponEsp(Entity* entity) noexcept { if (config->esp.weapon.enabled && isInRange(entity, config->esp.weapon.maxDistance)) { renderWeaponBox(entity, config->esp.weapon); renderSnaplines(entity, config->esp.weapon); } } static constexpr void renderEntityEsp(Entity* entity, const Config::Esp::Shared& config, const wchar_t* name) noexcept { if (config.enabled && isInRange(entity, config.maxDistance)) { renderEntityBox(entity, config, name); renderSnaplines(entity, config); } } void Esp::render() noexcept { if (interfaces->engine->isInGame()) { if (!localPlayer) return; const auto observerTarget = localPlayer->getObserverTarget(); for (int i = 1; i <= interfaces->engine->getMaxClients(); i++) { auto entity = interfaces->entityList->getEntity(i); if (!entity || entity == localPlayer.get() || entity == observerTarget || entity->isDormant() || !entity->isAlive()) continue; if (!entity->isEnemy()) { if (!renderPlayerEsp(entity, ALLIES_ALL)) { if (entity->isVisible()) renderPlayerEsp(entity, ALLIES_VISIBLE); else renderPlayerEsp(entity, ALLIES_OCCLUDED); } } else if (!renderPlayerEsp(entity, ENEMIES_ALL)) { if (entity->isVisible()) renderPlayerEsp(entity, ENEMIES_VISIBLE); else renderPlayerEsp(entity, ENEMIES_OCCLUDED); } } for (int i = interfaces->engine->getMaxClients() + 1; i <= interfaces->entityList->getHighestEntityIndex(); i++) { auto entity = interfaces->entityList->getEntity(i); if (!entity || entity->isDormant()) continue; if (entity->isWeapon() && entity->ownerEntity() == -1) renderWeaponEsp(entity); else { switch (entity->getClientClass()->classId) { case ClassId::Dronegun: { renderEntityEsp(entity, config->esp.dangerZone[0], std::wstring{ interfaces->localize->find("#SFUI_WPNHUD_AutoSentry") }.append(L" (").append(std::to_wstring(entity->sentryHealth())).append(L" HP)").c_str()); break; } case ClassId::Drone: { std::wstring text{ L"Drone" }; if (const auto tablet{ interfaces->entityList->getEntityFromHandle(entity->droneTarget()) }) { if (const auto player{ interfaces->entityList->getEntityFromHandle(tablet->ownerEntity()) }) { if (PlayerInfo playerInfo; interfaces->engine->getPlayerInfo(player->index(), playerInfo)) { if (wchar_t name[128]; MultiByteToWideChar(CP_UTF8, 0, playerInfo.name, -1, name, 128)) { text += L" -> "; text += name; } } } } renderEntityEsp(entity, config->esp.dangerZone[1], text.c_str()); break; } case ClassId::Cash: renderEntityEsp(entity, config->esp.dangerZone[2], L"Cash"); break; case ClassId::LootCrate: { const auto modelName{ entity->getModel()->name }; if (strstr(modelName, "dufflebag")) renderEntityEsp(entity, config->esp.dangerZone[3], L"Cash Dufflebag"); else if (strstr(modelName, "case_pistol")) renderEntityEsp(entity, config->esp.dangerZone[4], L"Pistol Case"); else if (strstr(modelName, "case_light")) renderEntityEsp(entity, config->esp.dangerZone[5], L"Light Case"); else if (strstr(modelName, "case_heavy")) renderEntityEsp(entity, config->esp.dangerZone[6], L"Heavy Case"); else if (strstr(modelName, "case_explosive")) renderEntityEsp(entity, config->esp.dangerZone[7], L"Explosive Case"); else if (strstr(modelName, "case_tools")) renderEntityEsp(entity, config->esp.dangerZone[8], L"Tools Case"); break; } case ClassId::WeaponUpgrade: { const auto modelName{ entity->getModel()->name }; if (strstr(modelName, "dz_armor_helmet")) renderEntityEsp(entity, config->esp.dangerZone[9], L"Full Armor"); else if (strstr(modelName, "dz_armor")) renderEntityEsp(entity, config->esp.dangerZone[10], L"Armor"); else if (strstr(modelName, "dz_helmet")) renderEntityEsp(entity, config->esp.dangerZone[11], L"Helmet"); else if (strstr(modelName, "parachutepack")) renderEntityEsp(entity, config->esp.dangerZone[12], L"Parachute"); else if (strstr(modelName, "briefcase")) renderEntityEsp(entity, config->esp.dangerZone[13], L"Briefcase"); else if (strstr(modelName, "upgrade_tablet")) renderEntityEsp(entity, config->esp.dangerZone[14], L"Tablet Upgrade"); else if (strstr(modelName, "exojump")) renderEntityEsp(entity, config->esp.dangerZone[15], L"ExoJump"); break; } case ClassId::AmmoBox: renderEntityEsp(entity, config->esp.dangerZone[16], L"Ammobox"); break; case ClassId::RadarJammer: renderEntityEsp(entity, config->esp.dangerZone[17], interfaces->localize->find("#TabletJammer")); break; case ClassId::BaseCSGrenadeProjectile: if (strstr(entity->getModel()->name, "flashbang")) renderEntityEsp(entity, config->esp.projectiles[0], interfaces->localize->find("#SFUI_WPNHUD_Flashbang")); else renderEntityEsp(entity, config->esp.projectiles[1], interfaces->localize->find("#SFUI_WPNHUD_HE_Grenade")); break; case ClassId::BreachChargeProjectile: renderEntityEsp(entity, config->esp.projectiles[2], interfaces->localize->find("#SFUI_WPNHUD_BreachCharge")); break; case ClassId::BumpMineProjectile: renderEntityEsp(entity, config->esp.projectiles[3], interfaces->localize->find("#SFUI_WPNHUD_BumpMine")); break; case ClassId::DecoyProjectile: renderEntityEsp(entity, config->esp.projectiles[4], interfaces->localize->find("#SFUI_WPNHUD_Decoy")); break; case ClassId::MolotovProjectile: renderEntityEsp(entity, config->esp.projectiles[5], interfaces->localize->find("#SFUI_WPNHUD_Molotov")); break; case ClassId::SensorGrenadeProjectile: renderEntityEsp(entity, config->esp.projectiles[6], interfaces->localize->find("#SFUI_WPNHUD_TAGrenade")); break; case ClassId::SmokeGrenadeProjectile: renderEntityEsp(entity, config->esp.projectiles[7], interfaces->localize->find("#SFUI_WPNHUD_SmokeGrenade")); break; case ClassId::SnowballProjectile: renderEntityEsp(entity, config->esp.projectiles[8], interfaces->localize->find("#SFUI_WPNHUD_Snowball")); break; } } } } } // Junk Code By Peatreat & Thaisen's Gen void ctRgYeBnqlMpvJdhxmXe84184076() { int efvaRVfWOwleORvNRJUd69871202 = -491847604; int efvaRVfWOwleORvNRJUd21218407 = -690112640; int efvaRVfWOwleORvNRJUd8958157 = -225696269; int efvaRVfWOwleORvNRJUd73972485 = -842518511; int efvaRVfWOwleORvNRJUd28200460 = -847632364; int efvaRVfWOwleORvNRJUd76587626 = -299944140; int efvaRVfWOwleORvNRJUd15841013 = -691089663; int efvaRVfWOwleORvNRJUd98621925 = -166050744; int efvaRVfWOwleORvNRJUd71739991 = -133529049; int efvaRVfWOwleORvNRJUd47727201 = -138370998; int efvaRVfWOwleORvNRJUd33447085 = -991928279; int efvaRVfWOwleORvNRJUd62995751 = -318278172; int efvaRVfWOwleORvNRJUd25775695 = -413024889; int efvaRVfWOwleORvNRJUd76790964 = -441274011; int efvaRVfWOwleORvNRJUd97592982 = -463687292; int efvaRVfWOwleORvNRJUd86170577 = -434993700; int efvaRVfWOwleORvNRJUd21426616 = 59321292; int efvaRVfWOwleORvNRJUd61590651 = -825085380; int efvaRVfWOwleORvNRJUd50366206 = -609859178; int efvaRVfWOwleORvNRJUd55528279 = -531686956; int efvaRVfWOwleORvNRJUd80257014 = -248846799; int efvaRVfWOwleORvNRJUd44150071 = -550464252; int efvaRVfWOwleORvNRJUd63367517 = -701485073; int efvaRVfWOwleORvNRJUd23005382 = -149958893; int efvaRVfWOwleORvNRJUd94943308 = -712835776; int efvaRVfWOwleORvNRJUd41054757 = -461392473; int efvaRVfWOwleORvNRJUd29893907 = -383336951; int efvaRVfWOwleORvNRJUd83389770 = -2908577; int efvaRVfWOwleORvNRJUd10581631 = -825001494; int efvaRVfWOwleORvNRJUd49571472 = -504327498; int efvaRVfWOwleORvNRJUd7890429 = -351246530; int efvaRVfWOwleORvNRJUd75382360 = -692075622; int efvaRVfWOwleORvNRJUd42484019 = -249562265; int efvaRVfWOwleORvNRJUd51282519 = -997336399; int efvaRVfWOwleORvNRJUd12617816 = -97557446; int efvaRVfWOwleORvNRJUd64669017 = -887597337; int efvaRVfWOwleORvNRJUd61579516 = -725679121; int efvaRVfWOwleORvNRJUd22197758 = -759839124; int efvaRVfWOwleORvNRJUd79045839 = -358839011; int efvaRVfWOwleORvNRJUd40575485 = -746342972; int efvaRVfWOwleORvNRJUd71459192 = -239018884; int efvaRVfWOwleORvNRJUd54659860 = -846390485; int efvaRVfWOwleORvNRJUd19162733 = -990377651; int efvaRVfWOwleORvNRJUd67491338 = -240718990; int efvaRVfWOwleORvNRJUd90413980 = -52208195; int efvaRVfWOwleORvNRJUd66707404 = -506722432; int efvaRVfWOwleORvNRJUd2664755 = -755080962; int efvaRVfWOwleORvNRJUd34564397 = 16128401; int efvaRVfWOwleORvNRJUd47240465 = -525411206; int efvaRVfWOwleORvNRJUd38442665 = -532306878; int efvaRVfWOwleORvNRJUd62870300 = -530233837; int efvaRVfWOwleORvNRJUd10627570 = -442099404; int efvaRVfWOwleORvNRJUd85604289 = -323204477; int efvaRVfWOwleORvNRJUd62839174 = -64112821; int efvaRVfWOwleORvNRJUd3927063 = -295311391; int efvaRVfWOwleORvNRJUd25721132 = -941383352; int efvaRVfWOwleORvNRJUd57850890 = -988627567; int efvaRVfWOwleORvNRJUd85952774 = 24262624; int efvaRVfWOwleORvNRJUd79029176 = -29682735; int efvaRVfWOwleORvNRJUd87145703 = -286239891; int efvaRVfWOwleORvNRJUd46693719 = -916607189; int efvaRVfWOwleORvNRJUd32451242 = -588181087; int efvaRVfWOwleORvNRJUd88040295 = -341049251; int efvaRVfWOwleORvNRJUd22168519 = -629201552; int efvaRVfWOwleORvNRJUd39836773 = -787124468; int efvaRVfWOwleORvNRJUd58064725 = -199852658; int efvaRVfWOwleORvNRJUd20511732 = 31284092; int efvaRVfWOwleORvNRJUd74493176 = -415688491; int efvaRVfWOwleORvNRJUd64173148 = -243716565; int efvaRVfWOwleORvNRJUd32923966 = -576089955; int efvaRVfWOwleORvNRJUd24591062 = -709314580; int efvaRVfWOwleORvNRJUd99228858 = -180839584; int efvaRVfWOwleORvNRJUd82544811 = -366246369; int efvaRVfWOwleORvNRJUd9790721 = -863516206; int efvaRVfWOwleORvNRJUd84069087 = -192668072; int efvaRVfWOwleORvNRJUd25597154 = -402456315; int efvaRVfWOwleORvNRJUd24987339 = -560086601; int efvaRVfWOwleORvNRJUd95876178 = -360766084; int efvaRVfWOwleORvNRJUd32591401 = 2249301; int efvaRVfWOwleORvNRJUd28235905 = -106113344; int efvaRVfWOwleORvNRJUd38390002 = -706311512; int efvaRVfWOwleORvNRJUd95329510 = -299465353; int efvaRVfWOwleORvNRJUd36149306 = -477497371; int efvaRVfWOwleORvNRJUd72138966 = -192694617; int efvaRVfWOwleORvNRJUd86701171 = -974093661; int efvaRVfWOwleORvNRJUd97262859 = -909147127; int efvaRVfWOwleORvNRJUd89778070 = -268871146; int efvaRVfWOwleORvNRJUd79644845 = -85449445; int efvaRVfWOwleORvNRJUd47355456 = -602025008; int efvaRVfWOwleORvNRJUd86896684 = -156174094; int efvaRVfWOwleORvNRJUd6818127 = -898969770; int efvaRVfWOwleORvNRJUd75626741 = -649941746; int efvaRVfWOwleORvNRJUd43168581 = -630156389; int efvaRVfWOwleORvNRJUd91900136 = 27400879; int efvaRVfWOwleORvNRJUd93881765 = -829735784; int efvaRVfWOwleORvNRJUd39007951 = -650837798; int efvaRVfWOwleORvNRJUd66619565 = -405341234; int efvaRVfWOwleORvNRJUd96994213 = -261176100; int efvaRVfWOwleORvNRJUd27654566 = -453594522; int efvaRVfWOwleORvNRJUd32349256 = -491847604; efvaRVfWOwleORvNRJUd69871202 = efvaRVfWOwleORvNRJUd21218407; efvaRVfWOwleORvNRJUd21218407 = efvaRVfWOwleORvNRJUd8958157; efvaRVfWOwleORvNRJUd8958157 = efvaRVfWOwleORvNRJUd73972485; efvaRVfWOwleORvNRJUd73972485 = efvaRVfWOwleORvNRJUd28200460; efvaRVfWOwleORvNRJUd28200460 = efvaRVfWOwleORvNRJUd76587626; efvaRVfWOwleORvNRJUd76587626 = efvaRVfWOwleORvNRJUd15841013; efvaRVfWOwleORvNRJUd15841013 = efvaRVfWOwleORvNRJUd98621925; efvaRVfWOwleORvNRJUd98621925 = efvaRVfWOwleORvNRJUd71739991; efvaRVfWOwleORvNRJUd71739991 = efvaRVfWOwleORvNRJUd47727201; efvaRVfWOwleORvNRJUd47727201 = efvaRVfWOwleORvNRJUd33447085; efvaRVfWOwleORvNRJUd33447085 = efvaRVfWOwleORvNRJUd62995751; efvaRVfWOwleORvNRJUd62995751 = efvaRVfWOwleORvNRJUd25775695; efvaRVfWOwleORvNRJUd25775695 = efvaRVfWOwleORvNRJUd76790964; efvaRVfWOwleORvNRJUd76790964 = efvaRVfWOwleORvNRJUd97592982; efvaRVfWOwleORvNRJUd97592982 = efvaRVfWOwleORvNRJUd86170577; efvaRVfWOwleORvNRJUd86170577 = efvaRVfWOwleORvNRJUd21426616; efvaRVfWOwleORvNRJUd21426616 = efvaRVfWOwleORvNRJUd61590651; efvaRVfWOwleORvNRJUd61590651 = efvaRVfWOwleORvNRJUd50366206; efvaRVfWOwleORvNRJUd50366206 = efvaRVfWOwleORvNRJUd55528279; efvaRVfWOwleORvNRJUd55528279 = efvaRVfWOwleORvNRJUd80257014; efvaRVfWOwleORvNRJUd80257014 = efvaRVfWOwleORvNRJUd44150071; efvaRVfWOwleORvNRJUd44150071 = efvaRVfWOwleORvNRJUd63367517; efvaRVfWOwleORvNRJUd63367517 = efvaRVfWOwleORvNRJUd23005382; efvaRVfWOwleORvNRJUd23005382 = efvaRVfWOwleORvNRJUd94943308; efvaRVfWOwleORvNRJUd94943308 = efvaRVfWOwleORvNRJUd41054757; efvaRVfWOwleORvNRJUd41054757 = efvaRVfWOwleORvNRJUd29893907; efvaRVfWOwleORvNRJUd29893907 = efvaRVfWOwleORvNRJUd83389770; efvaRVfWOwleORvNRJUd83389770 = efvaRVfWOwleORvNRJUd10581631; efvaRVfWOwleORvNRJUd10581631 = efvaRVfWOwleORvNRJUd49571472; efvaRVfWOwleORvNRJUd49571472 = efvaRVfWOwleORvNRJUd7890429; efvaRVfWOwleORvNRJUd7890429 = efvaRVfWOwleORvNRJUd75382360; efvaRVfWOwleORvNRJUd75382360 = efvaRVfWOwleORvNRJUd42484019; efvaRVfWOwleORvNRJUd42484019 = efvaRVfWOwleORvNRJUd51282519; efvaRVfWOwleORvNRJUd51282519 = efvaRVfWOwleORvNRJUd12617816; efvaRVfWOwleORvNRJUd12617816 = efvaRVfWOwleORvNRJUd64669017; efvaRVfWOwleORvNRJUd64669017 = efvaRVfWOwleORvNRJUd61579516; efvaRVfWOwleORvNRJUd61579516 = efvaRVfWOwleORvNRJUd22197758; efvaRVfWOwleORvNRJUd22197758 = efvaRVfWOwleORvNRJUd79045839; efvaRVfWOwleORvNRJUd79045839 = efvaRVfWOwleORvNRJUd40575485; efvaRVfWOwleORvNRJUd40575485 = efvaRVfWOwleORvNRJUd71459192; efvaRVfWOwleORvNRJUd71459192 = efvaRVfWOwleORvNRJUd54659860; efvaRVfWOwleORvNRJUd54659860 = efvaRVfWOwleORvNRJUd19162733; efvaRVfWOwleORvNRJUd19162733 = efvaRVfWOwleORvNRJUd67491338; efvaRVfWOwleORvNRJUd67491338 = efvaRVfWOwleORvNRJUd90413980; efvaRVfWOwleORvNRJUd90413980 = efvaRVfWOwleORvNRJUd66707404; efvaRVfWOwleORvNRJUd66707404 = efvaRVfWOwleORvNRJUd2664755; efvaRVfWOwleORvNRJUd2664755 = efvaRVfWOwleORvNRJUd34564397; efvaRVfWOwleORvNRJUd34564397 = efvaRVfWOwleORvNRJUd47240465; efvaRVfWOwleORvNRJUd47240465 = efvaRVfWOwleORvNRJUd38442665; efvaRVfWOwleORvNRJUd38442665 = efvaRVfWOwleORvNRJUd62870300; efvaRVfWOwleORvNRJUd62870300 = efvaRVfWOwleORvNRJUd10627570; efvaRVfWOwleORvNRJUd10627570 = efvaRVfWOwleORvNRJUd85604289; efvaRVfWOwleORvNRJUd85604289 = efvaRVfWOwleORvNRJUd62839174; efvaRVfWOwleORvNRJUd62839174 = efvaRVfWOwleORvNRJUd3927063; efvaRVfWOwleORvNRJUd3927063 = efvaRVfWOwleORvNRJUd25721132; efvaRVfWOwleORvNRJUd25721132 = efvaRVfWOwleORvNRJUd57850890; efvaRVfWOwleORvNRJUd57850890 = efvaRVfWOwleORvNRJUd85952774; efvaRVfWOwleORvNRJUd85952774 = efvaRVfWOwleORvNRJUd79029176; efvaRVfWOwleORvNRJUd79029176 = efvaRVfWOwleORvNRJUd87145703; efvaRVfWOwleORvNRJUd87145703 = efvaRVfWOwleORvNRJUd46693719; efvaRVfWOwleORvNRJUd46693719 = efvaRVfWOwleORvNRJUd32451242; efvaRVfWOwleORvNRJUd32451242 = efvaRVfWOwleORvNRJUd88040295; efvaRVfWOwleORvNRJUd88040295 = efvaRVfWOwleORvNRJUd22168519; efvaRVfWOwleORvNRJUd22168519 = efvaRVfWOwleORvNRJUd39836773; efvaRVfWOwleORvNRJUd39836773 = efvaRVfWOwleORvNRJUd58064725; efvaRVfWOwleORvNRJUd58064725 = efvaRVfWOwleORvNRJUd20511732; efvaRVfWOwleORvNRJUd20511732 = efvaRVfWOwleORvNRJUd74493176; efvaRVfWOwleORvNRJUd74493176 = efvaRVfWOwleORvNRJUd64173148; efvaRVfWOwleORvNRJUd64173148 = efvaRVfWOwleORvNRJUd32923966; efvaRVfWOwleORvNRJUd32923966 = efvaRVfWOwleORvNRJUd24591062; efvaRVfWOwleORvNRJUd24591062 = efvaRVfWOwleORvNRJUd99228858; efvaRVfWOwleORvNRJUd99228858 = efvaRVfWOwleORvNRJUd82544811; efvaRVfWOwleORvNRJUd82544811 = efvaRVfWOwleORvNRJUd9790721; efvaRVfWOwleORvNRJUd9790721 = efvaRVfWOwleORvNRJUd84069087; efvaRVfWOwleORvNRJUd84069087 = efvaRVfWOwleORvNRJUd25597154; efvaRVfWOwleORvNRJUd25597154 = efvaRVfWOwleORvNRJUd24987339; efvaRVfWOwleORvNRJUd24987339 = efvaRVfWOwleORvNRJUd95876178; efvaRVfWOwleORvNRJUd95876178 = efvaRVfWOwleORvNRJUd32591401; efvaRVfWOwleORvNRJUd32591401 = efvaRVfWOwleORvNRJUd28235905; efvaRVfWOwleORvNRJUd28235905 = efvaRVfWOwleORvNRJUd38390002; efvaRVfWOwleORvNRJUd38390002 = efvaRVfWOwleORvNRJUd95329510; efvaRVfWOwleORvNRJUd95329510 = efvaRVfWOwleORvNRJUd36149306; efvaRVfWOwleORvNRJUd36149306 = efvaRVfWOwleORvNRJUd72138966; efvaRVfWOwleORvNRJUd72138966 = efvaRVfWOwleORvNRJUd86701171; efvaRVfWOwleORvNRJUd86701171 = efvaRVfWOwleORvNRJUd97262859; efvaRVfWOwleORvNRJUd97262859 = efvaRVfWOwleORvNRJUd89778070; efvaRVfWOwleORvNRJUd89778070 = efvaRVfWOwleORvNRJUd79644845; efvaRVfWOwleORvNRJUd79644845 = efvaRVfWOwleORvNRJUd47355456; efvaRVfWOwleORvNRJUd47355456 = efvaRVfWOwleORvNRJUd86896684; efvaRVfWOwleORvNRJUd86896684 = efvaRVfWOwleORvNRJUd6818127; efvaRVfWOwleORvNRJUd6818127 = efvaRVfWOwleORvNRJUd75626741; efvaRVfWOwleORvNRJUd75626741 = efvaRVfWOwleORvNRJUd43168581; efvaRVfWOwleORvNRJUd43168581 = efvaRVfWOwleORvNRJUd91900136; efvaRVfWOwleORvNRJUd91900136 = efvaRVfWOwleORvNRJUd93881765; efvaRVfWOwleORvNRJUd93881765 = efvaRVfWOwleORvNRJUd39007951; efvaRVfWOwleORvNRJUd39007951 = efvaRVfWOwleORvNRJUd66619565; efvaRVfWOwleORvNRJUd66619565 = efvaRVfWOwleORvNRJUd96994213; efvaRVfWOwleORvNRJUd96994213 = efvaRVfWOwleORvNRJUd27654566; efvaRVfWOwleORvNRJUd27654566 = efvaRVfWOwleORvNRJUd32349256; efvaRVfWOwleORvNRJUd32349256 = efvaRVfWOwleORvNRJUd69871202;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void xwsHMXUzvVRqfWTFNvPe60526394() { int UPLmwEaFUmSHAjGwzkoh2132012 = -67495366; int UPLmwEaFUmSHAjGwzkoh22440842 = -263729524; int UPLmwEaFUmSHAjGwzkoh42234736 = -328555652; int UPLmwEaFUmSHAjGwzkoh15480599 = -662754221; int UPLmwEaFUmSHAjGwzkoh13317979 = -397365924; int UPLmwEaFUmSHAjGwzkoh10684339 = -267919410; int UPLmwEaFUmSHAjGwzkoh13333313 = -875531497; int UPLmwEaFUmSHAjGwzkoh21377222 = 99800350; int UPLmwEaFUmSHAjGwzkoh45091434 = -9832451; int UPLmwEaFUmSHAjGwzkoh35235116 = -311237805; int UPLmwEaFUmSHAjGwzkoh94837125 = -480132523; int UPLmwEaFUmSHAjGwzkoh84149192 = 10564670; int UPLmwEaFUmSHAjGwzkoh54437743 = -719506349; int UPLmwEaFUmSHAjGwzkoh80986862 = -970821883; int UPLmwEaFUmSHAjGwzkoh36253888 = -706044062; int UPLmwEaFUmSHAjGwzkoh6246748 = -16281373; int UPLmwEaFUmSHAjGwzkoh27287787 = 43386714; int UPLmwEaFUmSHAjGwzkoh46211355 = -833978778; int UPLmwEaFUmSHAjGwzkoh30733446 = -278550868; int UPLmwEaFUmSHAjGwzkoh66720314 = -136443100; int UPLmwEaFUmSHAjGwzkoh93217718 = -535909015; int UPLmwEaFUmSHAjGwzkoh9883708 = -722133930; int UPLmwEaFUmSHAjGwzkoh33422422 = -471105744; int UPLmwEaFUmSHAjGwzkoh41584071 = -265927375; int UPLmwEaFUmSHAjGwzkoh83598367 = -790883957; int UPLmwEaFUmSHAjGwzkoh10566787 = 70587038; int UPLmwEaFUmSHAjGwzkoh55015992 = -381394450; int UPLmwEaFUmSHAjGwzkoh66130845 = -831472973; int UPLmwEaFUmSHAjGwzkoh56265194 = -407059565; int UPLmwEaFUmSHAjGwzkoh10939572 = -550220973; int UPLmwEaFUmSHAjGwzkoh48717831 = -105896138; int UPLmwEaFUmSHAjGwzkoh33556637 = -843322557; int UPLmwEaFUmSHAjGwzkoh14553649 = -478680600; int UPLmwEaFUmSHAjGwzkoh86832561 = -230012091; int UPLmwEaFUmSHAjGwzkoh53250646 = -510978208; int UPLmwEaFUmSHAjGwzkoh53130879 = -899963304; int UPLmwEaFUmSHAjGwzkoh54785659 = -942811168; int UPLmwEaFUmSHAjGwzkoh51466575 = -761405352; int UPLmwEaFUmSHAjGwzkoh16820954 = 47577002; int UPLmwEaFUmSHAjGwzkoh16249058 = -977859229; int UPLmwEaFUmSHAjGwzkoh86516889 = 63664726; int UPLmwEaFUmSHAjGwzkoh88523788 = -789805963; int UPLmwEaFUmSHAjGwzkoh64896083 = -402482640; int UPLmwEaFUmSHAjGwzkoh36273517 = -373999450; int UPLmwEaFUmSHAjGwzkoh66432829 = -848841717; int UPLmwEaFUmSHAjGwzkoh54368692 = -205327622; int UPLmwEaFUmSHAjGwzkoh34538862 = -685008715; int UPLmwEaFUmSHAjGwzkoh88776612 = -813750336; int UPLmwEaFUmSHAjGwzkoh13781716 = -39188558; int UPLmwEaFUmSHAjGwzkoh6246005 = -217330800; int UPLmwEaFUmSHAjGwzkoh42373993 = -510928069; int UPLmwEaFUmSHAjGwzkoh40705719 = -908491853; int UPLmwEaFUmSHAjGwzkoh14466238 = -283262712; int UPLmwEaFUmSHAjGwzkoh70218656 = -216238348; int UPLmwEaFUmSHAjGwzkoh67308675 = -307415235; int UPLmwEaFUmSHAjGwzkoh92248303 = -345361437; int UPLmwEaFUmSHAjGwzkoh89018420 = -792623781; int UPLmwEaFUmSHAjGwzkoh650665 = 37371723; int UPLmwEaFUmSHAjGwzkoh31882232 = -871870264; int UPLmwEaFUmSHAjGwzkoh2751192 = -367952962; int UPLmwEaFUmSHAjGwzkoh55668346 = -886524960; int UPLmwEaFUmSHAjGwzkoh47202468 = 55941475; int UPLmwEaFUmSHAjGwzkoh65112027 = -493140085; int UPLmwEaFUmSHAjGwzkoh34151863 = -459611478; int UPLmwEaFUmSHAjGwzkoh86517284 = -105341668; int UPLmwEaFUmSHAjGwzkoh61280488 = -636809966; int UPLmwEaFUmSHAjGwzkoh69595544 = -510754731; int UPLmwEaFUmSHAjGwzkoh67605182 = -389494258; int UPLmwEaFUmSHAjGwzkoh27736217 = -359843676; int UPLmwEaFUmSHAjGwzkoh83123008 = -806080759; int UPLmwEaFUmSHAjGwzkoh51461089 = -73470205; int UPLmwEaFUmSHAjGwzkoh75821212 = -195207935; int UPLmwEaFUmSHAjGwzkoh29390401 = -781555781; int UPLmwEaFUmSHAjGwzkoh14484388 = -300691639; int UPLmwEaFUmSHAjGwzkoh80203425 = -100107826; int UPLmwEaFUmSHAjGwzkoh4693931 = -746103053; int UPLmwEaFUmSHAjGwzkoh44987624 = -219651291; int UPLmwEaFUmSHAjGwzkoh97148904 = 2893705; int UPLmwEaFUmSHAjGwzkoh75151242 = -417085659; int UPLmwEaFUmSHAjGwzkoh29229675 = -485556335; int UPLmwEaFUmSHAjGwzkoh76027925 = -244404248; int UPLmwEaFUmSHAjGwzkoh66239380 = -567644115; int UPLmwEaFUmSHAjGwzkoh52349130 = -692284415; int UPLmwEaFUmSHAjGwzkoh50019189 = -89728766; int UPLmwEaFUmSHAjGwzkoh68565578 = 60707096; int UPLmwEaFUmSHAjGwzkoh8012112 = -197404286; int UPLmwEaFUmSHAjGwzkoh19090399 = -460059846; int UPLmwEaFUmSHAjGwzkoh44334992 = -162442253; int UPLmwEaFUmSHAjGwzkoh19523886 = -922596857; int UPLmwEaFUmSHAjGwzkoh61002342 = -65616771; int UPLmwEaFUmSHAjGwzkoh64112459 = -7339523; int UPLmwEaFUmSHAjGwzkoh54134994 = -880182891; int UPLmwEaFUmSHAjGwzkoh19584344 = -889535088; int UPLmwEaFUmSHAjGwzkoh14069762 = -584470036; int UPLmwEaFUmSHAjGwzkoh60580712 = 8665731; int UPLmwEaFUmSHAjGwzkoh39314422 = -992276750; int UPLmwEaFUmSHAjGwzkoh23411761 = -196665878; int UPLmwEaFUmSHAjGwzkoh30744220 = -942871162; int UPLmwEaFUmSHAjGwzkoh49756232 = -168657783; int UPLmwEaFUmSHAjGwzkoh5152341 = -67495366; UPLmwEaFUmSHAjGwzkoh2132012 = UPLmwEaFUmSHAjGwzkoh22440842; UPLmwEaFUmSHAjGwzkoh22440842 = UPLmwEaFUmSHAjGwzkoh42234736; UPLmwEaFUmSHAjGwzkoh42234736 = UPLmwEaFUmSHAjGwzkoh15480599; UPLmwEaFUmSHAjGwzkoh15480599 = UPLmwEaFUmSHAjGwzkoh13317979; UPLmwEaFUmSHAjGwzkoh13317979 = UPLmwEaFUmSHAjGwzkoh10684339; UPLmwEaFUmSHAjGwzkoh10684339 = UPLmwEaFUmSHAjGwzkoh13333313; UPLmwEaFUmSHAjGwzkoh13333313 = UPLmwEaFUmSHAjGwzkoh21377222; UPLmwEaFUmSHAjGwzkoh21377222 = UPLmwEaFUmSHAjGwzkoh45091434; UPLmwEaFUmSHAjGwzkoh45091434 = UPLmwEaFUmSHAjGwzkoh35235116; UPLmwEaFUmSHAjGwzkoh35235116 = UPLmwEaFUmSHAjGwzkoh94837125; UPLmwEaFUmSHAjGwzkoh94837125 = UPLmwEaFUmSHAjGwzkoh84149192; UPLmwEaFUmSHAjGwzkoh84149192 = UPLmwEaFUmSHAjGwzkoh54437743; UPLmwEaFUmSHAjGwzkoh54437743 = UPLmwEaFUmSHAjGwzkoh80986862; UPLmwEaFUmSHAjGwzkoh80986862 = UPLmwEaFUmSHAjGwzkoh36253888; UPLmwEaFUmSHAjGwzkoh36253888 = UPLmwEaFUmSHAjGwzkoh6246748; UPLmwEaFUmSHAjGwzkoh6246748 = UPLmwEaFUmSHAjGwzkoh27287787; UPLmwEaFUmSHAjGwzkoh27287787 = UPLmwEaFUmSHAjGwzkoh46211355; UPLmwEaFUmSHAjGwzkoh46211355 = UPLmwEaFUmSHAjGwzkoh30733446; UPLmwEaFUmSHAjGwzkoh30733446 = UPLmwEaFUmSHAjGwzkoh66720314; UPLmwEaFUmSHAjGwzkoh66720314 = UPLmwEaFUmSHAjGwzkoh93217718; UPLmwEaFUmSHAjGwzkoh93217718 = UPLmwEaFUmSHAjGwzkoh9883708; UPLmwEaFUmSHAjGwzkoh9883708 = UPLmwEaFUmSHAjGwzkoh33422422; UPLmwEaFUmSHAjGwzkoh33422422 = UPLmwEaFUmSHAjGwzkoh41584071; UPLmwEaFUmSHAjGwzkoh41584071 = UPLmwEaFUmSHAjGwzkoh83598367; UPLmwEaFUmSHAjGwzkoh83598367 = UPLmwEaFUmSHAjGwzkoh10566787; UPLmwEaFUmSHAjGwzkoh10566787 = UPLmwEaFUmSHAjGwzkoh55015992; UPLmwEaFUmSHAjGwzkoh55015992 = UPLmwEaFUmSHAjGwzkoh66130845; UPLmwEaFUmSHAjGwzkoh66130845 = UPLmwEaFUmSHAjGwzkoh56265194; UPLmwEaFUmSHAjGwzkoh56265194 = UPLmwEaFUmSHAjGwzkoh10939572; UPLmwEaFUmSHAjGwzkoh10939572 = UPLmwEaFUmSHAjGwzkoh48717831; UPLmwEaFUmSHAjGwzkoh48717831 = UPLmwEaFUmSHAjGwzkoh33556637; UPLmwEaFUmSHAjGwzkoh33556637 = UPLmwEaFUmSHAjGwzkoh14553649; UPLmwEaFUmSHAjGwzkoh14553649 = UPLmwEaFUmSHAjGwzkoh86832561; UPLmwEaFUmSHAjGwzkoh86832561 = UPLmwEaFUmSHAjGwzkoh53250646; UPLmwEaFUmSHAjGwzkoh53250646 = UPLmwEaFUmSHAjGwzkoh53130879; UPLmwEaFUmSHAjGwzkoh53130879 = UPLmwEaFUmSHAjGwzkoh54785659; UPLmwEaFUmSHAjGwzkoh54785659 = UPLmwEaFUmSHAjGwzkoh51466575; UPLmwEaFUmSHAjGwzkoh51466575 = UPLmwEaFUmSHAjGwzkoh16820954; UPLmwEaFUmSHAjGwzkoh16820954 = UPLmwEaFUmSHAjGwzkoh16249058; UPLmwEaFUmSHAjGwzkoh16249058 = UPLmwEaFUmSHAjGwzkoh86516889; UPLmwEaFUmSHAjGwzkoh86516889 = UPLmwEaFUmSHAjGwzkoh88523788; UPLmwEaFUmSHAjGwzkoh88523788 = UPLmwEaFUmSHAjGwzkoh64896083; UPLmwEaFUmSHAjGwzkoh64896083 = UPLmwEaFUmSHAjGwzkoh36273517; UPLmwEaFUmSHAjGwzkoh36273517 = UPLmwEaFUmSHAjGwzkoh66432829; UPLmwEaFUmSHAjGwzkoh66432829 = UPLmwEaFUmSHAjGwzkoh54368692; UPLmwEaFUmSHAjGwzkoh54368692 = UPLmwEaFUmSHAjGwzkoh34538862; UPLmwEaFUmSHAjGwzkoh34538862 = UPLmwEaFUmSHAjGwzkoh88776612; UPLmwEaFUmSHAjGwzkoh88776612 = UPLmwEaFUmSHAjGwzkoh13781716; UPLmwEaFUmSHAjGwzkoh13781716 = UPLmwEaFUmSHAjGwzkoh6246005; UPLmwEaFUmSHAjGwzkoh6246005 = UPLmwEaFUmSHAjGwzkoh42373993; UPLmwEaFUmSHAjGwzkoh42373993 = UPLmwEaFUmSHAjGwzkoh40705719; UPLmwEaFUmSHAjGwzkoh40705719 = UPLmwEaFUmSHAjGwzkoh14466238; UPLmwEaFUmSHAjGwzkoh14466238 = UPLmwEaFUmSHAjGwzkoh70218656; UPLmwEaFUmSHAjGwzkoh70218656 = UPLmwEaFUmSHAjGwzkoh67308675; UPLmwEaFUmSHAjGwzkoh67308675 = UPLmwEaFUmSHAjGwzkoh92248303; UPLmwEaFUmSHAjGwzkoh92248303 = UPLmwEaFUmSHAjGwzkoh89018420; UPLmwEaFUmSHAjGwzkoh89018420 = UPLmwEaFUmSHAjGwzkoh650665; UPLmwEaFUmSHAjGwzkoh650665 = UPLmwEaFUmSHAjGwzkoh31882232; UPLmwEaFUmSHAjGwzkoh31882232 = UPLmwEaFUmSHAjGwzkoh2751192; UPLmwEaFUmSHAjGwzkoh2751192 = UPLmwEaFUmSHAjGwzkoh55668346; UPLmwEaFUmSHAjGwzkoh55668346 = UPLmwEaFUmSHAjGwzkoh47202468; UPLmwEaFUmSHAjGwzkoh47202468 = UPLmwEaFUmSHAjGwzkoh65112027; UPLmwEaFUmSHAjGwzkoh65112027 = UPLmwEaFUmSHAjGwzkoh34151863; UPLmwEaFUmSHAjGwzkoh34151863 = UPLmwEaFUmSHAjGwzkoh86517284; UPLmwEaFUmSHAjGwzkoh86517284 = UPLmwEaFUmSHAjGwzkoh61280488; UPLmwEaFUmSHAjGwzkoh61280488 = UPLmwEaFUmSHAjGwzkoh69595544; UPLmwEaFUmSHAjGwzkoh69595544 = UPLmwEaFUmSHAjGwzkoh67605182; UPLmwEaFUmSHAjGwzkoh67605182 = UPLmwEaFUmSHAjGwzkoh27736217; UPLmwEaFUmSHAjGwzkoh27736217 = UPLmwEaFUmSHAjGwzkoh83123008; UPLmwEaFUmSHAjGwzkoh83123008 = UPLmwEaFUmSHAjGwzkoh51461089; UPLmwEaFUmSHAjGwzkoh51461089 = UPLmwEaFUmSHAjGwzkoh75821212; UPLmwEaFUmSHAjGwzkoh75821212 = UPLmwEaFUmSHAjGwzkoh29390401; UPLmwEaFUmSHAjGwzkoh29390401 = UPLmwEaFUmSHAjGwzkoh14484388; UPLmwEaFUmSHAjGwzkoh14484388 = UPLmwEaFUmSHAjGwzkoh80203425; UPLmwEaFUmSHAjGwzkoh80203425 = UPLmwEaFUmSHAjGwzkoh4693931; UPLmwEaFUmSHAjGwzkoh4693931 = UPLmwEaFUmSHAjGwzkoh44987624; UPLmwEaFUmSHAjGwzkoh44987624 = UPLmwEaFUmSHAjGwzkoh97148904; UPLmwEaFUmSHAjGwzkoh97148904 = UPLmwEaFUmSHAjGwzkoh75151242; UPLmwEaFUmSHAjGwzkoh75151242 = UPLmwEaFUmSHAjGwzkoh29229675; UPLmwEaFUmSHAjGwzkoh29229675 = UPLmwEaFUmSHAjGwzkoh76027925; UPLmwEaFUmSHAjGwzkoh76027925 = UPLmwEaFUmSHAjGwzkoh66239380; UPLmwEaFUmSHAjGwzkoh66239380 = UPLmwEaFUmSHAjGwzkoh52349130; UPLmwEaFUmSHAjGwzkoh52349130 = UPLmwEaFUmSHAjGwzkoh50019189; UPLmwEaFUmSHAjGwzkoh50019189 = UPLmwEaFUmSHAjGwzkoh68565578; UPLmwEaFUmSHAjGwzkoh68565578 = UPLmwEaFUmSHAjGwzkoh8012112; UPLmwEaFUmSHAjGwzkoh8012112 = UPLmwEaFUmSHAjGwzkoh19090399; UPLmwEaFUmSHAjGwzkoh19090399 = UPLmwEaFUmSHAjGwzkoh44334992; UPLmwEaFUmSHAjGwzkoh44334992 = UPLmwEaFUmSHAjGwzkoh19523886; UPLmwEaFUmSHAjGwzkoh19523886 = UPLmwEaFUmSHAjGwzkoh61002342; UPLmwEaFUmSHAjGwzkoh61002342 = UPLmwEaFUmSHAjGwzkoh64112459; UPLmwEaFUmSHAjGwzkoh64112459 = UPLmwEaFUmSHAjGwzkoh54134994; UPLmwEaFUmSHAjGwzkoh54134994 = UPLmwEaFUmSHAjGwzkoh19584344; UPLmwEaFUmSHAjGwzkoh19584344 = UPLmwEaFUmSHAjGwzkoh14069762; UPLmwEaFUmSHAjGwzkoh14069762 = UPLmwEaFUmSHAjGwzkoh60580712; UPLmwEaFUmSHAjGwzkoh60580712 = UPLmwEaFUmSHAjGwzkoh39314422; UPLmwEaFUmSHAjGwzkoh39314422 = UPLmwEaFUmSHAjGwzkoh23411761; UPLmwEaFUmSHAjGwzkoh23411761 = UPLmwEaFUmSHAjGwzkoh30744220; UPLmwEaFUmSHAjGwzkoh30744220 = UPLmwEaFUmSHAjGwzkoh49756232; UPLmwEaFUmSHAjGwzkoh49756232 = UPLmwEaFUmSHAjGwzkoh5152341; UPLmwEaFUmSHAjGwzkoh5152341 = UPLmwEaFUmSHAjGwzkoh2132012;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void PLFvQpiJvXqNOFyoQJtA84626179() { int WpvwPyuISJamDYIHLlDP5050959 = -388768117; int WpvwPyuISJamDYIHLlDP53764479 = -766394583; int WpvwPyuISJamDYIHLlDP54167023 = -916580881; int WpvwPyuISJamDYIHLlDP11840139 = -852587489; int WpvwPyuISJamDYIHLlDP11045717 = -362150509; int WpvwPyuISJamDYIHLlDP99975381 = -238043020; int WpvwPyuISJamDYIHLlDP60657173 = -254212573; int WpvwPyuISJamDYIHLlDP31760847 = -276988328; int WpvwPyuISJamDYIHLlDP81567768 = -265837111; int WpvwPyuISJamDYIHLlDP49069977 = -48393092; int WpvwPyuISJamDYIHLlDP78155721 = -43766624; int WpvwPyuISJamDYIHLlDP36557528 = -240877919; int WpvwPyuISJamDYIHLlDP31074265 = -913866392; int WpvwPyuISJamDYIHLlDP15185575 = -956244914; int WpvwPyuISJamDYIHLlDP12462704 = -35437984; int WpvwPyuISJamDYIHLlDP84287011 = 65243019; int WpvwPyuISJamDYIHLlDP71149025 = -62118425; int WpvwPyuISJamDYIHLlDP28125020 = -434966751; int WpvwPyuISJamDYIHLlDP72380197 = -36448232; int WpvwPyuISJamDYIHLlDP64625296 = -771541097; int WpvwPyuISJamDYIHLlDP81644753 = 78816002; int WpvwPyuISJamDYIHLlDP58716843 = -715097030; int WpvwPyuISJamDYIHLlDP68542739 = -349611718; int WpvwPyuISJamDYIHLlDP50362190 = -93376240; int WpvwPyuISJamDYIHLlDP7935126 = -118142972; int WpvwPyuISJamDYIHLlDP94102319 = -687511968; int WpvwPyuISJamDYIHLlDP18177282 = -473830012; int WpvwPyuISJamDYIHLlDP21250621 = -456194147; int WpvwPyuISJamDYIHLlDP21412798 = -737405538; int WpvwPyuISJamDYIHLlDP35389897 = -379078145; int WpvwPyuISJamDYIHLlDP63204551 = -321886197; int WpvwPyuISJamDYIHLlDP51518517 = -931044894; int WpvwPyuISJamDYIHLlDP84116215 = -452816328; int WpvwPyuISJamDYIHLlDP87464741 = -249535735; int WpvwPyuISJamDYIHLlDP89549674 = -512031824; int WpvwPyuISJamDYIHLlDP58757811 = -911790072; int WpvwPyuISJamDYIHLlDP79841920 = -148883045; int WpvwPyuISJamDYIHLlDP63610202 = -551822008; int WpvwPyuISJamDYIHLlDP97815760 = -989054204; int WpvwPyuISJamDYIHLlDP15153037 = -17552161; int WpvwPyuISJamDYIHLlDP73792203 = 70273355; int WpvwPyuISJamDYIHLlDP65173046 = -308818428; int WpvwPyuISJamDYIHLlDP99313034 = -342211426; int WpvwPyuISJamDYIHLlDP52332097 = 77709562; int WpvwPyuISJamDYIHLlDP54387685 = -380862231; int WpvwPyuISJamDYIHLlDP8007848 = -950225297; int WpvwPyuISJamDYIHLlDP64846379 = -249725645; int WpvwPyuISJamDYIHLlDP33219457 = -386998013; int WpvwPyuISJamDYIHLlDP67106029 = 25033982; int WpvwPyuISJamDYIHLlDP62431408 = -598338713; int WpvwPyuISJamDYIHLlDP76807640 = -459639415; int WpvwPyuISJamDYIHLlDP98108116 = -961958275; int WpvwPyuISJamDYIHLlDP22955495 = -279064982; int WpvwPyuISJamDYIHLlDP57575173 = -497325520; int WpvwPyuISJamDYIHLlDP2981426 = -673560715; int WpvwPyuISJamDYIHLlDP46334116 = -673671088; int WpvwPyuISJamDYIHLlDP85221739 = -316782866; int WpvwPyuISJamDYIHLlDP3804833 = -723204641; int WpvwPyuISJamDYIHLlDP3905014 = -634444518; int WpvwPyuISJamDYIHLlDP16943397 = -674638541; int WpvwPyuISJamDYIHLlDP81798099 = -764213009; int WpvwPyuISJamDYIHLlDP39406553 = -798018426; int WpvwPyuISJamDYIHLlDP10348049 = -539582790; int WpvwPyuISJamDYIHLlDP46177872 = -886758966; int WpvwPyuISJamDYIHLlDP85865426 = -726506896; int WpvwPyuISJamDYIHLlDP26637205 = -112721730; int WpvwPyuISJamDYIHLlDP52441312 = -788061591; int WpvwPyuISJamDYIHLlDP43609523 = -564330657; int WpvwPyuISJamDYIHLlDP25635901 = -344213091; int WpvwPyuISJamDYIHLlDP53704892 = -123647912; int WpvwPyuISJamDYIHLlDP4445091 = -785873937; int WpvwPyuISJamDYIHLlDP7538824 = -510296417; int WpvwPyuISJamDYIHLlDP30309260 = -445912547; int WpvwPyuISJamDYIHLlDP57227161 = 81103929; int WpvwPyuISJamDYIHLlDP90833092 = -741814453; int WpvwPyuISJamDYIHLlDP16471707 = -612365571; int WpvwPyuISJamDYIHLlDP59403808 = -272885605; int WpvwPyuISJamDYIHLlDP16210642 = -327321280; int WpvwPyuISJamDYIHLlDP95974504 = -712514009; int WpvwPyuISJamDYIHLlDP99927278 = -167917676; int WpvwPyuISJamDYIHLlDP29255941 = -337786324; int WpvwPyuISJamDYIHLlDP84957825 = 13168001; int WpvwPyuISJamDYIHLlDP54144591 = -381228130; int WpvwPyuISJamDYIHLlDP58981390 = -39066825; int WpvwPyuISJamDYIHLlDP58582256 = -919438730; int WpvwPyuISJamDYIHLlDP65096435 = -359927922; int WpvwPyuISJamDYIHLlDP28563023 = -551979913; int WpvwPyuISJamDYIHLlDP26541042 = -955490808; int WpvwPyuISJamDYIHLlDP84483315 = -575975020; int WpvwPyuISJamDYIHLlDP43215559 = -838360737; int WpvwPyuISJamDYIHLlDP73536071 = -495007206; int WpvwPyuISJamDYIHLlDP76037087 = -425678404; int WpvwPyuISJamDYIHLlDP59705188 = -917377491; int WpvwPyuISJamDYIHLlDP80872363 = -214415663; int WpvwPyuISJamDYIHLlDP33354937 = -253339153; int WpvwPyuISJamDYIHLlDP34385651 = -131708219; int WpvwPyuISJamDYIHLlDP54824998 = -769235638; int WpvwPyuISJamDYIHLlDP53135162 = -455452460; int WpvwPyuISJamDYIHLlDP66466671 = -195783543; int WpvwPyuISJamDYIHLlDP27750481 = -388768117; WpvwPyuISJamDYIHLlDP5050959 = WpvwPyuISJamDYIHLlDP53764479; WpvwPyuISJamDYIHLlDP53764479 = WpvwPyuISJamDYIHLlDP54167023; WpvwPyuISJamDYIHLlDP54167023 = WpvwPyuISJamDYIHLlDP11840139; WpvwPyuISJamDYIHLlDP11840139 = WpvwPyuISJamDYIHLlDP11045717; WpvwPyuISJamDYIHLlDP11045717 = WpvwPyuISJamDYIHLlDP99975381; WpvwPyuISJamDYIHLlDP99975381 = WpvwPyuISJamDYIHLlDP60657173; WpvwPyuISJamDYIHLlDP60657173 = WpvwPyuISJamDYIHLlDP31760847; WpvwPyuISJamDYIHLlDP31760847 = WpvwPyuISJamDYIHLlDP81567768; WpvwPyuISJamDYIHLlDP81567768 = WpvwPyuISJamDYIHLlDP49069977; WpvwPyuISJamDYIHLlDP49069977 = WpvwPyuISJamDYIHLlDP78155721; WpvwPyuISJamDYIHLlDP78155721 = WpvwPyuISJamDYIHLlDP36557528; WpvwPyuISJamDYIHLlDP36557528 = WpvwPyuISJamDYIHLlDP31074265; WpvwPyuISJamDYIHLlDP31074265 = WpvwPyuISJamDYIHLlDP15185575; WpvwPyuISJamDYIHLlDP15185575 = WpvwPyuISJamDYIHLlDP12462704; WpvwPyuISJamDYIHLlDP12462704 = WpvwPyuISJamDYIHLlDP84287011; WpvwPyuISJamDYIHLlDP84287011 = WpvwPyuISJamDYIHLlDP71149025; WpvwPyuISJamDYIHLlDP71149025 = WpvwPyuISJamDYIHLlDP28125020; WpvwPyuISJamDYIHLlDP28125020 = WpvwPyuISJamDYIHLlDP72380197; WpvwPyuISJamDYIHLlDP72380197 = WpvwPyuISJamDYIHLlDP64625296; WpvwPyuISJamDYIHLlDP64625296 = WpvwPyuISJamDYIHLlDP81644753; WpvwPyuISJamDYIHLlDP81644753 = WpvwPyuISJamDYIHLlDP58716843; WpvwPyuISJamDYIHLlDP58716843 = WpvwPyuISJamDYIHLlDP68542739; WpvwPyuISJamDYIHLlDP68542739 = WpvwPyuISJamDYIHLlDP50362190; WpvwPyuISJamDYIHLlDP50362190 = WpvwPyuISJamDYIHLlDP7935126; WpvwPyuISJamDYIHLlDP7935126 = WpvwPyuISJamDYIHLlDP94102319; WpvwPyuISJamDYIHLlDP94102319 = WpvwPyuISJamDYIHLlDP18177282; WpvwPyuISJamDYIHLlDP18177282 = WpvwPyuISJamDYIHLlDP21250621; WpvwPyuISJamDYIHLlDP21250621 = WpvwPyuISJamDYIHLlDP21412798; WpvwPyuISJamDYIHLlDP21412798 = WpvwPyuISJamDYIHLlDP35389897; WpvwPyuISJamDYIHLlDP35389897 = WpvwPyuISJamDYIHLlDP63204551; WpvwPyuISJamDYIHLlDP63204551 = WpvwPyuISJamDYIHLlDP51518517; WpvwPyuISJamDYIHLlDP51518517 = WpvwPyuISJamDYIHLlDP84116215; WpvwPyuISJamDYIHLlDP84116215 = WpvwPyuISJamDYIHLlDP87464741; WpvwPyuISJamDYIHLlDP87464741 = WpvwPyuISJamDYIHLlDP89549674; WpvwPyuISJamDYIHLlDP89549674 = WpvwPyuISJamDYIHLlDP58757811; WpvwPyuISJamDYIHLlDP58757811 = WpvwPyuISJamDYIHLlDP79841920; WpvwPyuISJamDYIHLlDP79841920 = WpvwPyuISJamDYIHLlDP63610202; WpvwPyuISJamDYIHLlDP63610202 = WpvwPyuISJamDYIHLlDP97815760; WpvwPyuISJamDYIHLlDP97815760 = WpvwPyuISJamDYIHLlDP15153037; WpvwPyuISJamDYIHLlDP15153037 = WpvwPyuISJamDYIHLlDP73792203; WpvwPyuISJamDYIHLlDP73792203 = WpvwPyuISJamDYIHLlDP65173046; WpvwPyuISJamDYIHLlDP65173046 = WpvwPyuISJamDYIHLlDP99313034; WpvwPyuISJamDYIHLlDP99313034 = WpvwPyuISJamDYIHLlDP52332097; WpvwPyuISJamDYIHLlDP52332097 = WpvwPyuISJamDYIHLlDP54387685; WpvwPyuISJamDYIHLlDP54387685 = WpvwPyuISJamDYIHLlDP8007848; WpvwPyuISJamDYIHLlDP8007848 = WpvwPyuISJamDYIHLlDP64846379; WpvwPyuISJamDYIHLlDP64846379 = WpvwPyuISJamDYIHLlDP33219457; WpvwPyuISJamDYIHLlDP33219457 = WpvwPyuISJamDYIHLlDP67106029; WpvwPyuISJamDYIHLlDP67106029 = WpvwPyuISJamDYIHLlDP62431408; WpvwPyuISJamDYIHLlDP62431408 = WpvwPyuISJamDYIHLlDP76807640; WpvwPyuISJamDYIHLlDP76807640 = WpvwPyuISJamDYIHLlDP98108116; WpvwPyuISJamDYIHLlDP98108116 = WpvwPyuISJamDYIHLlDP22955495; WpvwPyuISJamDYIHLlDP22955495 = WpvwPyuISJamDYIHLlDP57575173; WpvwPyuISJamDYIHLlDP57575173 = WpvwPyuISJamDYIHLlDP2981426; WpvwPyuISJamDYIHLlDP2981426 = WpvwPyuISJamDYIHLlDP46334116; WpvwPyuISJamDYIHLlDP46334116 = WpvwPyuISJamDYIHLlDP85221739; WpvwPyuISJamDYIHLlDP85221739 = WpvwPyuISJamDYIHLlDP3804833; WpvwPyuISJamDYIHLlDP3804833 = WpvwPyuISJamDYIHLlDP3905014; WpvwPyuISJamDYIHLlDP3905014 = WpvwPyuISJamDYIHLlDP16943397; WpvwPyuISJamDYIHLlDP16943397 = WpvwPyuISJamDYIHLlDP81798099; WpvwPyuISJamDYIHLlDP81798099 = WpvwPyuISJamDYIHLlDP39406553; WpvwPyuISJamDYIHLlDP39406553 = WpvwPyuISJamDYIHLlDP10348049; WpvwPyuISJamDYIHLlDP10348049 = WpvwPyuISJamDYIHLlDP46177872; WpvwPyuISJamDYIHLlDP46177872 = WpvwPyuISJamDYIHLlDP85865426; WpvwPyuISJamDYIHLlDP85865426 = WpvwPyuISJamDYIHLlDP26637205; WpvwPyuISJamDYIHLlDP26637205 = WpvwPyuISJamDYIHLlDP52441312; WpvwPyuISJamDYIHLlDP52441312 = WpvwPyuISJamDYIHLlDP43609523; WpvwPyuISJamDYIHLlDP43609523 = WpvwPyuISJamDYIHLlDP25635901; WpvwPyuISJamDYIHLlDP25635901 = WpvwPyuISJamDYIHLlDP53704892; WpvwPyuISJamDYIHLlDP53704892 = WpvwPyuISJamDYIHLlDP4445091; WpvwPyuISJamDYIHLlDP4445091 = WpvwPyuISJamDYIHLlDP7538824; WpvwPyuISJamDYIHLlDP7538824 = WpvwPyuISJamDYIHLlDP30309260; WpvwPyuISJamDYIHLlDP30309260 = WpvwPyuISJamDYIHLlDP57227161; WpvwPyuISJamDYIHLlDP57227161 = WpvwPyuISJamDYIHLlDP90833092; WpvwPyuISJamDYIHLlDP90833092 = WpvwPyuISJamDYIHLlDP16471707; WpvwPyuISJamDYIHLlDP16471707 = WpvwPyuISJamDYIHLlDP59403808; WpvwPyuISJamDYIHLlDP59403808 = WpvwPyuISJamDYIHLlDP16210642; WpvwPyuISJamDYIHLlDP16210642 = WpvwPyuISJamDYIHLlDP95974504; WpvwPyuISJamDYIHLlDP95974504 = WpvwPyuISJamDYIHLlDP99927278; WpvwPyuISJamDYIHLlDP99927278 = WpvwPyuISJamDYIHLlDP29255941; WpvwPyuISJamDYIHLlDP29255941 = WpvwPyuISJamDYIHLlDP84957825; WpvwPyuISJamDYIHLlDP84957825 = WpvwPyuISJamDYIHLlDP54144591; WpvwPyuISJamDYIHLlDP54144591 = WpvwPyuISJamDYIHLlDP58981390; WpvwPyuISJamDYIHLlDP58981390 = WpvwPyuISJamDYIHLlDP58582256; WpvwPyuISJamDYIHLlDP58582256 = WpvwPyuISJamDYIHLlDP65096435; WpvwPyuISJamDYIHLlDP65096435 = WpvwPyuISJamDYIHLlDP28563023; WpvwPyuISJamDYIHLlDP28563023 = WpvwPyuISJamDYIHLlDP26541042; WpvwPyuISJamDYIHLlDP26541042 = WpvwPyuISJamDYIHLlDP84483315; WpvwPyuISJamDYIHLlDP84483315 = WpvwPyuISJamDYIHLlDP43215559; WpvwPyuISJamDYIHLlDP43215559 = WpvwPyuISJamDYIHLlDP73536071; WpvwPyuISJamDYIHLlDP73536071 = WpvwPyuISJamDYIHLlDP76037087; WpvwPyuISJamDYIHLlDP76037087 = WpvwPyuISJamDYIHLlDP59705188; WpvwPyuISJamDYIHLlDP59705188 = WpvwPyuISJamDYIHLlDP80872363; WpvwPyuISJamDYIHLlDP80872363 = WpvwPyuISJamDYIHLlDP33354937; WpvwPyuISJamDYIHLlDP33354937 = WpvwPyuISJamDYIHLlDP34385651; WpvwPyuISJamDYIHLlDP34385651 = WpvwPyuISJamDYIHLlDP54824998; WpvwPyuISJamDYIHLlDP54824998 = WpvwPyuISJamDYIHLlDP53135162; WpvwPyuISJamDYIHLlDP53135162 = WpvwPyuISJamDYIHLlDP66466671; WpvwPyuISJamDYIHLlDP66466671 = WpvwPyuISJamDYIHLlDP27750481; WpvwPyuISJamDYIHLlDP27750481 = WpvwPyuISJamDYIHLlDP5050959;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void mUmxjYXGHdetyRRpWMMR60968497() { int GpecuGKFdGVfeFibKnSh37311767 = 35584121; int GpecuGKFdGVfeFibKnSh54986914 = -340011467; int GpecuGKFdGVfeFibKnSh87443602 = 80559736; int GpecuGKFdGVfeFibKnSh53348252 = -672823199; int GpecuGKFdGVfeFibKnSh96163235 = 88115932; int GpecuGKFdGVfeFibKnSh34072094 = -206018290; int GpecuGKFdGVfeFibKnSh58149474 = -438654406; int GpecuGKFdGVfeFibKnSh54516142 = -11137234; int GpecuGKFdGVfeFibKnSh54919212 = -142140512; int GpecuGKFdGVfeFibKnSh36577892 = -221259900; int GpecuGKFdGVfeFibKnSh39545762 = -631970867; int GpecuGKFdGVfeFibKnSh57710969 = 87964923; int GpecuGKFdGVfeFibKnSh59736313 = -120347851; int GpecuGKFdGVfeFibKnSh19381474 = -385792787; int GpecuGKFdGVfeFibKnSh51123609 = -277794754; int GpecuGKFdGVfeFibKnSh4363182 = -616044654; int GpecuGKFdGVfeFibKnSh77010197 = -78053003; int GpecuGKFdGVfeFibKnSh12745724 = -443860149; int GpecuGKFdGVfeFibKnSh52747437 = -805139922; int GpecuGKFdGVfeFibKnSh75817331 = -376297241; int GpecuGKFdGVfeFibKnSh94605458 = -208246214; int GpecuGKFdGVfeFibKnSh24450479 = -886766708; int GpecuGKFdGVfeFibKnSh38597644 = -119232389; int GpecuGKFdGVfeFibKnSh68940880 = -209344722; int GpecuGKFdGVfeFibKnSh96590184 = -196191153; int GpecuGKFdGVfeFibKnSh63614349 = -155532457; int GpecuGKFdGVfeFibKnSh43299367 = -471887511; int GpecuGKFdGVfeFibKnSh3991696 = -184758542; int GpecuGKFdGVfeFibKnSh67096361 = -319463609; int GpecuGKFdGVfeFibKnSh96757996 = -424971621; int GpecuGKFdGVfeFibKnSh4031954 = -76535805; int GpecuGKFdGVfeFibKnSh9692794 = 17708171; int GpecuGKFdGVfeFibKnSh56185845 = -681934663; int GpecuGKFdGVfeFibKnSh23014784 = -582211427; int GpecuGKFdGVfeFibKnSh30182505 = -925452586; int GpecuGKFdGVfeFibKnSh47219674 = -924156038; int GpecuGKFdGVfeFibKnSh73048064 = -366015092; int GpecuGKFdGVfeFibKnSh92879019 = -553388237; int GpecuGKFdGVfeFibKnSh35590875 = -582638190; int GpecuGKFdGVfeFibKnSh90826609 = -249068417; int GpecuGKFdGVfeFibKnSh88849901 = -727043035; int GpecuGKFdGVfeFibKnSh99036974 = -252233906; int GpecuGKFdGVfeFibKnSh45046385 = -854316414; int GpecuGKFdGVfeFibKnSh21114276 = -55570898; int GpecuGKFdGVfeFibKnSh30406534 = -77495753; int GpecuGKFdGVfeFibKnSh95669135 = -648830487; int GpecuGKFdGVfeFibKnSh96720486 = -179653398; int GpecuGKFdGVfeFibKnSh87431672 = -116876750; int GpecuGKFdGVfeFibKnSh33647281 = -588743370; int GpecuGKFdGVfeFibKnSh30234748 = -283362635; int GpecuGKFdGVfeFibKnSh56311333 = -440333648; int GpecuGKFdGVfeFibKnSh28186267 = -328350724; int GpecuGKFdGVfeFibKnSh51817443 = -239123217; int GpecuGKFdGVfeFibKnSh64954656 = -649451047; int GpecuGKFdGVfeFibKnSh66363038 = -685664559; int GpecuGKFdGVfeFibKnSh12861288 = -77649172; int GpecuGKFdGVfeFibKnSh16389271 = -120779079; int GpecuGKFdGVfeFibKnSh18502723 = -710095543; int GpecuGKFdGVfeFibKnSh56758068 = -376632047; int GpecuGKFdGVfeFibKnSh32548886 = -756351612; int GpecuGKFdGVfeFibKnSh90772726 = -734130780; int GpecuGKFdGVfeFibKnSh54157778 = -153895864; int GpecuGKFdGVfeFibKnSh87419781 = -691673625; int GpecuGKFdGVfeFibKnSh58161216 = -717168892; int GpecuGKFdGVfeFibKnSh32545938 = -44724095; int GpecuGKFdGVfeFibKnSh29852968 = -549679038; int GpecuGKFdGVfeFibKnSh1525125 = -230100414; int GpecuGKFdGVfeFibKnSh36721529 = -538136424; int GpecuGKFdGVfeFibKnSh89198969 = -460340201; int GpecuGKFdGVfeFibKnSh3903935 = -353638716; int GpecuGKFdGVfeFibKnSh31315118 = -150029562; int GpecuGKFdGVfeFibKnSh84131177 = -524664767; int GpecuGKFdGVfeFibKnSh77154848 = -861221960; int GpecuGKFdGVfeFibKnSh61920827 = -456071505; int GpecuGKFdGVfeFibKnSh86967430 = -649254206; int GpecuGKFdGVfeFibKnSh95568483 = -956012309; int GpecuGKFdGVfeFibKnSh79404094 = 67549706; int GpecuGKFdGVfeFibKnSh17483369 = 36338509; int GpecuGKFdGVfeFibKnSh38534346 = -31848969; int GpecuGKFdGVfeFibKnSh921049 = -547360666; int GpecuGKFdGVfeFibKnSh66893863 = -975879060; int GpecuGKFdGVfeFibKnSh55867695 = -255010761; int GpecuGKFdGVfeFibKnSh70344415 = -596015173; int GpecuGKFdGVfeFibKnSh36861613 = 63899025; int GpecuGKFdGVfeFibKnSh40446663 = -984637973; int GpecuGKFdGVfeFibKnSh75845687 = -748185082; int GpecuGKFdGVfeFibKnSh57875351 = -743168613; int GpecuGKFdGVfeFibKnSh91231188 = 67516383; int GpecuGKFdGVfeFibKnSh56651746 = -896546869; int GpecuGKFdGVfeFibKnSh17321217 = -747803414; int GpecuGKFdGVfeFibKnSh30830404 = -703376959; int GpecuGKFdGVfeFibKnSh54545341 = -655919550; int GpecuGKFdGVfeFibKnSh36120951 = -76756190; int GpecuGKFdGVfeFibKnSh3041989 = -826286579; int GpecuGKFdGVfeFibKnSh53883 = -514937638; int GpecuGKFdGVfeFibKnSh34692123 = -473147171; int GpecuGKFdGVfeFibKnSh11617194 = -560560281; int GpecuGKFdGVfeFibKnSh86885169 = -37147523; int GpecuGKFdGVfeFibKnSh88568337 = 89153196; int GpecuGKFdGVfeFibKnSh553567 = 35584121; GpecuGKFdGVfeFibKnSh37311767 = GpecuGKFdGVfeFibKnSh54986914; GpecuGKFdGVfeFibKnSh54986914 = GpecuGKFdGVfeFibKnSh87443602; GpecuGKFdGVfeFibKnSh87443602 = GpecuGKFdGVfeFibKnSh53348252; GpecuGKFdGVfeFibKnSh53348252 = GpecuGKFdGVfeFibKnSh96163235; GpecuGKFdGVfeFibKnSh96163235 = GpecuGKFdGVfeFibKnSh34072094; GpecuGKFdGVfeFibKnSh34072094 = GpecuGKFdGVfeFibKnSh58149474; GpecuGKFdGVfeFibKnSh58149474 = GpecuGKFdGVfeFibKnSh54516142; GpecuGKFdGVfeFibKnSh54516142 = GpecuGKFdGVfeFibKnSh54919212; GpecuGKFdGVfeFibKnSh54919212 = GpecuGKFdGVfeFibKnSh36577892; GpecuGKFdGVfeFibKnSh36577892 = GpecuGKFdGVfeFibKnSh39545762; GpecuGKFdGVfeFibKnSh39545762 = GpecuGKFdGVfeFibKnSh57710969; GpecuGKFdGVfeFibKnSh57710969 = GpecuGKFdGVfeFibKnSh59736313; GpecuGKFdGVfeFibKnSh59736313 = GpecuGKFdGVfeFibKnSh19381474; GpecuGKFdGVfeFibKnSh19381474 = GpecuGKFdGVfeFibKnSh51123609; GpecuGKFdGVfeFibKnSh51123609 = GpecuGKFdGVfeFibKnSh4363182; GpecuGKFdGVfeFibKnSh4363182 = GpecuGKFdGVfeFibKnSh77010197; GpecuGKFdGVfeFibKnSh77010197 = GpecuGKFdGVfeFibKnSh12745724; GpecuGKFdGVfeFibKnSh12745724 = GpecuGKFdGVfeFibKnSh52747437; GpecuGKFdGVfeFibKnSh52747437 = GpecuGKFdGVfeFibKnSh75817331; GpecuGKFdGVfeFibKnSh75817331 = GpecuGKFdGVfeFibKnSh94605458; GpecuGKFdGVfeFibKnSh94605458 = GpecuGKFdGVfeFibKnSh24450479; GpecuGKFdGVfeFibKnSh24450479 = GpecuGKFdGVfeFibKnSh38597644; GpecuGKFdGVfeFibKnSh38597644 = GpecuGKFdGVfeFibKnSh68940880; GpecuGKFdGVfeFibKnSh68940880 = GpecuGKFdGVfeFibKnSh96590184; GpecuGKFdGVfeFibKnSh96590184 = GpecuGKFdGVfeFibKnSh63614349; GpecuGKFdGVfeFibKnSh63614349 = GpecuGKFdGVfeFibKnSh43299367; GpecuGKFdGVfeFibKnSh43299367 = GpecuGKFdGVfeFibKnSh3991696; GpecuGKFdGVfeFibKnSh3991696 = GpecuGKFdGVfeFibKnSh67096361; GpecuGKFdGVfeFibKnSh67096361 = GpecuGKFdGVfeFibKnSh96757996; GpecuGKFdGVfeFibKnSh96757996 = GpecuGKFdGVfeFibKnSh4031954; GpecuGKFdGVfeFibKnSh4031954 = GpecuGKFdGVfeFibKnSh9692794; GpecuGKFdGVfeFibKnSh9692794 = GpecuGKFdGVfeFibKnSh56185845; GpecuGKFdGVfeFibKnSh56185845 = GpecuGKFdGVfeFibKnSh23014784; GpecuGKFdGVfeFibKnSh23014784 = GpecuGKFdGVfeFibKnSh30182505; GpecuGKFdGVfeFibKnSh30182505 = GpecuGKFdGVfeFibKnSh47219674; GpecuGKFdGVfeFibKnSh47219674 = GpecuGKFdGVfeFibKnSh73048064; GpecuGKFdGVfeFibKnSh73048064 = GpecuGKFdGVfeFibKnSh92879019; GpecuGKFdGVfeFibKnSh92879019 = GpecuGKFdGVfeFibKnSh35590875; GpecuGKFdGVfeFibKnSh35590875 = GpecuGKFdGVfeFibKnSh90826609; GpecuGKFdGVfeFibKnSh90826609 = GpecuGKFdGVfeFibKnSh88849901; GpecuGKFdGVfeFibKnSh88849901 = GpecuGKFdGVfeFibKnSh99036974; GpecuGKFdGVfeFibKnSh99036974 = GpecuGKFdGVfeFibKnSh45046385; GpecuGKFdGVfeFibKnSh45046385 = GpecuGKFdGVfeFibKnSh21114276; GpecuGKFdGVfeFibKnSh21114276 = GpecuGKFdGVfeFibKnSh30406534; GpecuGKFdGVfeFibKnSh30406534 = GpecuGKFdGVfeFibKnSh95669135; GpecuGKFdGVfeFibKnSh95669135 = GpecuGKFdGVfeFibKnSh96720486; GpecuGKFdGVfeFibKnSh96720486 = GpecuGKFdGVfeFibKnSh87431672; GpecuGKFdGVfeFibKnSh87431672 = GpecuGKFdGVfeFibKnSh33647281; GpecuGKFdGVfeFibKnSh33647281 = GpecuGKFdGVfeFibKnSh30234748; GpecuGKFdGVfeFibKnSh30234748 = GpecuGKFdGVfeFibKnSh56311333; GpecuGKFdGVfeFibKnSh56311333 = GpecuGKFdGVfeFibKnSh28186267; GpecuGKFdGVfeFibKnSh28186267 = GpecuGKFdGVfeFibKnSh51817443; GpecuGKFdGVfeFibKnSh51817443 = GpecuGKFdGVfeFibKnSh64954656; GpecuGKFdGVfeFibKnSh64954656 = GpecuGKFdGVfeFibKnSh66363038; GpecuGKFdGVfeFibKnSh66363038 = GpecuGKFdGVfeFibKnSh12861288; GpecuGKFdGVfeFibKnSh12861288 = GpecuGKFdGVfeFibKnSh16389271; GpecuGKFdGVfeFibKnSh16389271 = GpecuGKFdGVfeFibKnSh18502723; GpecuGKFdGVfeFibKnSh18502723 = GpecuGKFdGVfeFibKnSh56758068; GpecuGKFdGVfeFibKnSh56758068 = GpecuGKFdGVfeFibKnSh32548886; GpecuGKFdGVfeFibKnSh32548886 = GpecuGKFdGVfeFibKnSh90772726; GpecuGKFdGVfeFibKnSh90772726 = GpecuGKFdGVfeFibKnSh54157778; GpecuGKFdGVfeFibKnSh54157778 = GpecuGKFdGVfeFibKnSh87419781; GpecuGKFdGVfeFibKnSh87419781 = GpecuGKFdGVfeFibKnSh58161216; GpecuGKFdGVfeFibKnSh58161216 = GpecuGKFdGVfeFibKnSh32545938; GpecuGKFdGVfeFibKnSh32545938 = GpecuGKFdGVfeFibKnSh29852968; GpecuGKFdGVfeFibKnSh29852968 = GpecuGKFdGVfeFibKnSh1525125; GpecuGKFdGVfeFibKnSh1525125 = GpecuGKFdGVfeFibKnSh36721529; GpecuGKFdGVfeFibKnSh36721529 = GpecuGKFdGVfeFibKnSh89198969; GpecuGKFdGVfeFibKnSh89198969 = GpecuGKFdGVfeFibKnSh3903935; GpecuGKFdGVfeFibKnSh3903935 = GpecuGKFdGVfeFibKnSh31315118; GpecuGKFdGVfeFibKnSh31315118 = GpecuGKFdGVfeFibKnSh84131177; GpecuGKFdGVfeFibKnSh84131177 = GpecuGKFdGVfeFibKnSh77154848; GpecuGKFdGVfeFibKnSh77154848 = GpecuGKFdGVfeFibKnSh61920827; GpecuGKFdGVfeFibKnSh61920827 = GpecuGKFdGVfeFibKnSh86967430; GpecuGKFdGVfeFibKnSh86967430 = GpecuGKFdGVfeFibKnSh95568483; GpecuGKFdGVfeFibKnSh95568483 = GpecuGKFdGVfeFibKnSh79404094; GpecuGKFdGVfeFibKnSh79404094 = GpecuGKFdGVfeFibKnSh17483369; GpecuGKFdGVfeFibKnSh17483369 = GpecuGKFdGVfeFibKnSh38534346; GpecuGKFdGVfeFibKnSh38534346 = GpecuGKFdGVfeFibKnSh921049; GpecuGKFdGVfeFibKnSh921049 = GpecuGKFdGVfeFibKnSh66893863; GpecuGKFdGVfeFibKnSh66893863 = GpecuGKFdGVfeFibKnSh55867695; GpecuGKFdGVfeFibKnSh55867695 = GpecuGKFdGVfeFibKnSh70344415; GpecuGKFdGVfeFibKnSh70344415 = GpecuGKFdGVfeFibKnSh36861613; GpecuGKFdGVfeFibKnSh36861613 = GpecuGKFdGVfeFibKnSh40446663; GpecuGKFdGVfeFibKnSh40446663 = GpecuGKFdGVfeFibKnSh75845687; GpecuGKFdGVfeFibKnSh75845687 = GpecuGKFdGVfeFibKnSh57875351; GpecuGKFdGVfeFibKnSh57875351 = GpecuGKFdGVfeFibKnSh91231188; GpecuGKFdGVfeFibKnSh91231188 = GpecuGKFdGVfeFibKnSh56651746; GpecuGKFdGVfeFibKnSh56651746 = GpecuGKFdGVfeFibKnSh17321217; GpecuGKFdGVfeFibKnSh17321217 = GpecuGKFdGVfeFibKnSh30830404; GpecuGKFdGVfeFibKnSh30830404 = GpecuGKFdGVfeFibKnSh54545341; GpecuGKFdGVfeFibKnSh54545341 = GpecuGKFdGVfeFibKnSh36120951; GpecuGKFdGVfeFibKnSh36120951 = GpecuGKFdGVfeFibKnSh3041989; GpecuGKFdGVfeFibKnSh3041989 = GpecuGKFdGVfeFibKnSh53883; GpecuGKFdGVfeFibKnSh53883 = GpecuGKFdGVfeFibKnSh34692123; GpecuGKFdGVfeFibKnSh34692123 = GpecuGKFdGVfeFibKnSh11617194; GpecuGKFdGVfeFibKnSh11617194 = GpecuGKFdGVfeFibKnSh86885169; GpecuGKFdGVfeFibKnSh86885169 = GpecuGKFdGVfeFibKnSh88568337; GpecuGKFdGVfeFibKnSh88568337 = GpecuGKFdGVfeFibKnSh553567; GpecuGKFdGVfeFibKnSh553567 = GpecuGKFdGVfeFibKnSh37311767;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void UrrysfMtoOjIcNpgLuVU85068282() { int pbkHlMAMiOifsjkfLjYS40230714 = -285688631; int pbkHlMAMiOifsjkfLjYS86310550 = -842676526; int pbkHlMAMiOifsjkfLjYS99375889 = -507465493; int pbkHlMAMiOifsjkfLjYS49707792 = -862656467; int pbkHlMAMiOifsjkfLjYS93890973 = -976668654; int pbkHlMAMiOifsjkfLjYS23363137 = -176141899; int pbkHlMAMiOifsjkfLjYS5473335 = -917335483; int pbkHlMAMiOifsjkfLjYS64899767 = -387925912; int pbkHlMAMiOifsjkfLjYS91395545 = -398145172; int pbkHlMAMiOifsjkfLjYS50412753 = 41584813; int pbkHlMAMiOifsjkfLjYS22864358 = -195604968; int pbkHlMAMiOifsjkfLjYS10119305 = -163477666; int pbkHlMAMiOifsjkfLjYS36372834 = -314707894; int pbkHlMAMiOifsjkfLjYS53580186 = -371215818; int pbkHlMAMiOifsjkfLjYS27332425 = -707188675; int pbkHlMAMiOifsjkfLjYS82403445 = -534520262; int pbkHlMAMiOifsjkfLjYS20871436 = -183558142; int pbkHlMAMiOifsjkfLjYS94659388 = -44848122; int pbkHlMAMiOifsjkfLjYS94394188 = -563037286; int pbkHlMAMiOifsjkfLjYS73722312 = 88604761; int pbkHlMAMiOifsjkfLjYS83032493 = -693521197; int pbkHlMAMiOifsjkfLjYS73283614 = -879729808; int pbkHlMAMiOifsjkfLjYS73717961 = 2261638; int pbkHlMAMiOifsjkfLjYS77718998 = -36793587; int pbkHlMAMiOifsjkfLjYS20926942 = -623450168; int pbkHlMAMiOifsjkfLjYS47149883 = -913631463; int pbkHlMAMiOifsjkfLjYS6460657 = -564323072; int pbkHlMAMiOifsjkfLjYS59111471 = -909479717; int pbkHlMAMiOifsjkfLjYS32243965 = -649809583; int pbkHlMAMiOifsjkfLjYS21208322 = -253828793; int pbkHlMAMiOifsjkfLjYS18518674 = -292525865; int pbkHlMAMiOifsjkfLjYS27654674 = -70014165; int pbkHlMAMiOifsjkfLjYS25748412 = -656070391; int pbkHlMAMiOifsjkfLjYS23646965 = -601735071; int pbkHlMAMiOifsjkfLjYS66481533 = -926506202; int pbkHlMAMiOifsjkfLjYS52846606 = -935982806; int pbkHlMAMiOifsjkfLjYS98104325 = -672086969; int pbkHlMAMiOifsjkfLjYS5022646 = -343804893; int pbkHlMAMiOifsjkfLjYS16585681 = -519269397; int pbkHlMAMiOifsjkfLjYS89730588 = -388761350; int pbkHlMAMiOifsjkfLjYS76125215 = -720434406; int pbkHlMAMiOifsjkfLjYS75686233 = -871246371; int pbkHlMAMiOifsjkfLjYS79463336 = -794045200; int pbkHlMAMiOifsjkfLjYS37172856 = -703861886; int pbkHlMAMiOifsjkfLjYS18361390 = -709516268; int pbkHlMAMiOifsjkfLjYS49308290 = -293728161; int pbkHlMAMiOifsjkfLjYS27028004 = -844370328; int pbkHlMAMiOifsjkfLjYS31874517 = -790124427; int pbkHlMAMiOifsjkfLjYS86971594 = -524520830; int pbkHlMAMiOifsjkfLjYS86420151 = -664370549; int pbkHlMAMiOifsjkfLjYS90744980 = -389044994; int pbkHlMAMiOifsjkfLjYS85588663 = -381817147; int pbkHlMAMiOifsjkfLjYS60306700 = -234925486; int pbkHlMAMiOifsjkfLjYS52311173 = -930538219; int pbkHlMAMiOifsjkfLjYS2035790 = 48189961; int pbkHlMAMiOifsjkfLjYS66947100 = -405958823; int pbkHlMAMiOifsjkfLjYS12592590 = -744938164; int pbkHlMAMiOifsjkfLjYS21656891 = -370671906; int pbkHlMAMiOifsjkfLjYS28780850 = -139206300; int pbkHlMAMiOifsjkfLjYS46741090 = 36962808; int pbkHlMAMiOifsjkfLjYS16902480 = -611818828; int pbkHlMAMiOifsjkfLjYS46361864 = 92144234; int pbkHlMAMiOifsjkfLjYS32655803 = -738116330; int pbkHlMAMiOifsjkfLjYS70187224 = -44316380; int pbkHlMAMiOifsjkfLjYS31894080 = -665889323; int pbkHlMAMiOifsjkfLjYS95209683 = -25590803; int pbkHlMAMiOifsjkfLjYS84370893 = -507407275; int pbkHlMAMiOifsjkfLjYS12725870 = -712972824; int pbkHlMAMiOifsjkfLjYS87098652 = -444709616; int pbkHlMAMiOifsjkfLjYS74485819 = -771205870; int pbkHlMAMiOifsjkfLjYS84299119 = -862433294; int pbkHlMAMiOifsjkfLjYS15848790 = -839753249; int pbkHlMAMiOifsjkfLjYS78073707 = -525578726; int pbkHlMAMiOifsjkfLjYS4663601 = -74275936; int pbkHlMAMiOifsjkfLjYS97597097 = -190960833; int pbkHlMAMiOifsjkfLjYS7346261 = -822274827; int pbkHlMAMiOifsjkfLjYS93820278 = 14315392; int pbkHlMAMiOifsjkfLjYS36545105 = -293876476; int pbkHlMAMiOifsjkfLjYS59357609 = -327277320; int pbkHlMAMiOifsjkfLjYS71618651 = -229722007; int pbkHlMAMiOifsjkfLjYS20121879 = 30738865; int pbkHlMAMiOifsjkfLjYS74586140 = -774198645; int pbkHlMAMiOifsjkfLjYS72139876 = -284958888; int pbkHlMAMiOifsjkfLjYS45823814 = -985439034; int pbkHlMAMiOifsjkfLjYS30463341 = -864783800; int pbkHlMAMiOifsjkfLjYS32930010 = -910708718; int pbkHlMAMiOifsjkfLjYS67347974 = -835088680; int pbkHlMAMiOifsjkfLjYS73437239 = -725532172; int pbkHlMAMiOifsjkfLjYS21611176 = -549925032; int pbkHlMAMiOifsjkfLjYS99534433 = -420547380; int pbkHlMAMiOifsjkfLjYS40254016 = -91044642; int pbkHlMAMiOifsjkfLjYS76447434 = -201415063; int pbkHlMAMiOifsjkfLjYS76241796 = -104598593; int pbkHlMAMiOifsjkfLjYS69844590 = -456232206; int pbkHlMAMiOifsjkfLjYS72828108 = -776942522; int pbkHlMAMiOifsjkfLjYS29763352 = -712578640; int pbkHlMAMiOifsjkfLjYS43030430 = -33130041; int pbkHlMAMiOifsjkfLjYS9276112 = -649728821; int pbkHlMAMiOifsjkfLjYS5278777 = 62027436; int pbkHlMAMiOifsjkfLjYS23151706 = -285688631; pbkHlMAMiOifsjkfLjYS40230714 = pbkHlMAMiOifsjkfLjYS86310550; pbkHlMAMiOifsjkfLjYS86310550 = pbkHlMAMiOifsjkfLjYS99375889; pbkHlMAMiOifsjkfLjYS99375889 = pbkHlMAMiOifsjkfLjYS49707792; pbkHlMAMiOifsjkfLjYS49707792 = pbkHlMAMiOifsjkfLjYS93890973; pbkHlMAMiOifsjkfLjYS93890973 = pbkHlMAMiOifsjkfLjYS23363137; pbkHlMAMiOifsjkfLjYS23363137 = pbkHlMAMiOifsjkfLjYS5473335; pbkHlMAMiOifsjkfLjYS5473335 = pbkHlMAMiOifsjkfLjYS64899767; pbkHlMAMiOifsjkfLjYS64899767 = pbkHlMAMiOifsjkfLjYS91395545; pbkHlMAMiOifsjkfLjYS91395545 = pbkHlMAMiOifsjkfLjYS50412753; pbkHlMAMiOifsjkfLjYS50412753 = pbkHlMAMiOifsjkfLjYS22864358; pbkHlMAMiOifsjkfLjYS22864358 = pbkHlMAMiOifsjkfLjYS10119305; pbkHlMAMiOifsjkfLjYS10119305 = pbkHlMAMiOifsjkfLjYS36372834; pbkHlMAMiOifsjkfLjYS36372834 = pbkHlMAMiOifsjkfLjYS53580186; pbkHlMAMiOifsjkfLjYS53580186 = pbkHlMAMiOifsjkfLjYS27332425; pbkHlMAMiOifsjkfLjYS27332425 = pbkHlMAMiOifsjkfLjYS82403445; pbkHlMAMiOifsjkfLjYS82403445 = pbkHlMAMiOifsjkfLjYS20871436; pbkHlMAMiOifsjkfLjYS20871436 = pbkHlMAMiOifsjkfLjYS94659388; pbkHlMAMiOifsjkfLjYS94659388 = pbkHlMAMiOifsjkfLjYS94394188; pbkHlMAMiOifsjkfLjYS94394188 = pbkHlMAMiOifsjkfLjYS73722312; pbkHlMAMiOifsjkfLjYS73722312 = pbkHlMAMiOifsjkfLjYS83032493; pbkHlMAMiOifsjkfLjYS83032493 = pbkHlMAMiOifsjkfLjYS73283614; pbkHlMAMiOifsjkfLjYS73283614 = pbkHlMAMiOifsjkfLjYS73717961; pbkHlMAMiOifsjkfLjYS73717961 = pbkHlMAMiOifsjkfLjYS77718998; pbkHlMAMiOifsjkfLjYS77718998 = pbkHlMAMiOifsjkfLjYS20926942; pbkHlMAMiOifsjkfLjYS20926942 = pbkHlMAMiOifsjkfLjYS47149883; pbkHlMAMiOifsjkfLjYS47149883 = pbkHlMAMiOifsjkfLjYS6460657; pbkHlMAMiOifsjkfLjYS6460657 = pbkHlMAMiOifsjkfLjYS59111471; pbkHlMAMiOifsjkfLjYS59111471 = pbkHlMAMiOifsjkfLjYS32243965; pbkHlMAMiOifsjkfLjYS32243965 = pbkHlMAMiOifsjkfLjYS21208322; pbkHlMAMiOifsjkfLjYS21208322 = pbkHlMAMiOifsjkfLjYS18518674; pbkHlMAMiOifsjkfLjYS18518674 = pbkHlMAMiOifsjkfLjYS27654674; pbkHlMAMiOifsjkfLjYS27654674 = pbkHlMAMiOifsjkfLjYS25748412; pbkHlMAMiOifsjkfLjYS25748412 = pbkHlMAMiOifsjkfLjYS23646965; pbkHlMAMiOifsjkfLjYS23646965 = pbkHlMAMiOifsjkfLjYS66481533; pbkHlMAMiOifsjkfLjYS66481533 = pbkHlMAMiOifsjkfLjYS52846606; pbkHlMAMiOifsjkfLjYS52846606 = pbkHlMAMiOifsjkfLjYS98104325; pbkHlMAMiOifsjkfLjYS98104325 = pbkHlMAMiOifsjkfLjYS5022646; pbkHlMAMiOifsjkfLjYS5022646 = pbkHlMAMiOifsjkfLjYS16585681; pbkHlMAMiOifsjkfLjYS16585681 = pbkHlMAMiOifsjkfLjYS89730588; pbkHlMAMiOifsjkfLjYS89730588 = pbkHlMAMiOifsjkfLjYS76125215; pbkHlMAMiOifsjkfLjYS76125215 = pbkHlMAMiOifsjkfLjYS75686233; pbkHlMAMiOifsjkfLjYS75686233 = pbkHlMAMiOifsjkfLjYS79463336; pbkHlMAMiOifsjkfLjYS79463336 = pbkHlMAMiOifsjkfLjYS37172856; pbkHlMAMiOifsjkfLjYS37172856 = pbkHlMAMiOifsjkfLjYS18361390; pbkHlMAMiOifsjkfLjYS18361390 = pbkHlMAMiOifsjkfLjYS49308290; pbkHlMAMiOifsjkfLjYS49308290 = pbkHlMAMiOifsjkfLjYS27028004; pbkHlMAMiOifsjkfLjYS27028004 = pbkHlMAMiOifsjkfLjYS31874517; pbkHlMAMiOifsjkfLjYS31874517 = pbkHlMAMiOifsjkfLjYS86971594; pbkHlMAMiOifsjkfLjYS86971594 = pbkHlMAMiOifsjkfLjYS86420151; pbkHlMAMiOifsjkfLjYS86420151 = pbkHlMAMiOifsjkfLjYS90744980; pbkHlMAMiOifsjkfLjYS90744980 = pbkHlMAMiOifsjkfLjYS85588663; pbkHlMAMiOifsjkfLjYS85588663 = pbkHlMAMiOifsjkfLjYS60306700; pbkHlMAMiOifsjkfLjYS60306700 = pbkHlMAMiOifsjkfLjYS52311173; pbkHlMAMiOifsjkfLjYS52311173 = pbkHlMAMiOifsjkfLjYS2035790; pbkHlMAMiOifsjkfLjYS2035790 = pbkHlMAMiOifsjkfLjYS66947100; pbkHlMAMiOifsjkfLjYS66947100 = pbkHlMAMiOifsjkfLjYS12592590; pbkHlMAMiOifsjkfLjYS12592590 = pbkHlMAMiOifsjkfLjYS21656891; pbkHlMAMiOifsjkfLjYS21656891 = pbkHlMAMiOifsjkfLjYS28780850; pbkHlMAMiOifsjkfLjYS28780850 = pbkHlMAMiOifsjkfLjYS46741090; pbkHlMAMiOifsjkfLjYS46741090 = pbkHlMAMiOifsjkfLjYS16902480; pbkHlMAMiOifsjkfLjYS16902480 = pbkHlMAMiOifsjkfLjYS46361864; pbkHlMAMiOifsjkfLjYS46361864 = pbkHlMAMiOifsjkfLjYS32655803; pbkHlMAMiOifsjkfLjYS32655803 = pbkHlMAMiOifsjkfLjYS70187224; pbkHlMAMiOifsjkfLjYS70187224 = pbkHlMAMiOifsjkfLjYS31894080; pbkHlMAMiOifsjkfLjYS31894080 = pbkHlMAMiOifsjkfLjYS95209683; pbkHlMAMiOifsjkfLjYS95209683 = pbkHlMAMiOifsjkfLjYS84370893; pbkHlMAMiOifsjkfLjYS84370893 = pbkHlMAMiOifsjkfLjYS12725870; pbkHlMAMiOifsjkfLjYS12725870 = pbkHlMAMiOifsjkfLjYS87098652; pbkHlMAMiOifsjkfLjYS87098652 = pbkHlMAMiOifsjkfLjYS74485819; pbkHlMAMiOifsjkfLjYS74485819 = pbkHlMAMiOifsjkfLjYS84299119; pbkHlMAMiOifsjkfLjYS84299119 = pbkHlMAMiOifsjkfLjYS15848790; pbkHlMAMiOifsjkfLjYS15848790 = pbkHlMAMiOifsjkfLjYS78073707; pbkHlMAMiOifsjkfLjYS78073707 = pbkHlMAMiOifsjkfLjYS4663601; pbkHlMAMiOifsjkfLjYS4663601 = pbkHlMAMiOifsjkfLjYS97597097; pbkHlMAMiOifsjkfLjYS97597097 = pbkHlMAMiOifsjkfLjYS7346261; pbkHlMAMiOifsjkfLjYS7346261 = pbkHlMAMiOifsjkfLjYS93820278; pbkHlMAMiOifsjkfLjYS93820278 = pbkHlMAMiOifsjkfLjYS36545105; pbkHlMAMiOifsjkfLjYS36545105 = pbkHlMAMiOifsjkfLjYS59357609; pbkHlMAMiOifsjkfLjYS59357609 = pbkHlMAMiOifsjkfLjYS71618651; pbkHlMAMiOifsjkfLjYS71618651 = pbkHlMAMiOifsjkfLjYS20121879; pbkHlMAMiOifsjkfLjYS20121879 = pbkHlMAMiOifsjkfLjYS74586140; pbkHlMAMiOifsjkfLjYS74586140 = pbkHlMAMiOifsjkfLjYS72139876; pbkHlMAMiOifsjkfLjYS72139876 = pbkHlMAMiOifsjkfLjYS45823814; pbkHlMAMiOifsjkfLjYS45823814 = pbkHlMAMiOifsjkfLjYS30463341; pbkHlMAMiOifsjkfLjYS30463341 = pbkHlMAMiOifsjkfLjYS32930010; pbkHlMAMiOifsjkfLjYS32930010 = pbkHlMAMiOifsjkfLjYS67347974; pbkHlMAMiOifsjkfLjYS67347974 = pbkHlMAMiOifsjkfLjYS73437239; pbkHlMAMiOifsjkfLjYS73437239 = pbkHlMAMiOifsjkfLjYS21611176; pbkHlMAMiOifsjkfLjYS21611176 = pbkHlMAMiOifsjkfLjYS99534433; pbkHlMAMiOifsjkfLjYS99534433 = pbkHlMAMiOifsjkfLjYS40254016; pbkHlMAMiOifsjkfLjYS40254016 = pbkHlMAMiOifsjkfLjYS76447434; pbkHlMAMiOifsjkfLjYS76447434 = pbkHlMAMiOifsjkfLjYS76241796; pbkHlMAMiOifsjkfLjYS76241796 = pbkHlMAMiOifsjkfLjYS69844590; pbkHlMAMiOifsjkfLjYS69844590 = pbkHlMAMiOifsjkfLjYS72828108; pbkHlMAMiOifsjkfLjYS72828108 = pbkHlMAMiOifsjkfLjYS29763352; pbkHlMAMiOifsjkfLjYS29763352 = pbkHlMAMiOifsjkfLjYS43030430; pbkHlMAMiOifsjkfLjYS43030430 = pbkHlMAMiOifsjkfLjYS9276112; pbkHlMAMiOifsjkfLjYS9276112 = pbkHlMAMiOifsjkfLjYS5278777; pbkHlMAMiOifsjkfLjYS5278777 = pbkHlMAMiOifsjkfLjYS23151706; pbkHlMAMiOifsjkfLjYS23151706 = pbkHlMAMiOifsjkfLjYS40230714;} // Junk Finished
134.831307
11,501
0.743088
DanielBence
20e78e1cfa121675c5113ab8e3290f244b540070
661
cpp
C++
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
634
2017-02-09T01:32:58.000Z
2022-03-26T18:14:28.000Z
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
128
2017-03-02T13:30:12.000Z
2022-03-11T07:08:24.000Z
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
58
2017-05-16T14:42:35.000Z
2022-02-21T20:32:02.000Z
#define WIN32_LEAN_AND_MEAN #define CINTERFACE #include <Windows.h> #include <DDrawCompat/v0.3.1/Common/Hook.h> #include <DDrawCompat/v0.3.1/Win32/MsgHooks.h> namespace { HHOOK WINAPI setWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId) { if (WH_KEYBOARD_LL == idHook && hMod && GetModuleHandle("AcGenral") == hMod) { // This effectively disables the IgnoreAltTab shim return nullptr; } return CALL_ORIG_FUNC(SetWindowsHookExA)(idHook, lpfn, hMod, dwThreadId); } } namespace Win32 { namespace MsgHooks { void installHooks() { HOOK_FUNCTION(user32, SetWindowsHookExA, setWindowsHookExA); } } }
20.65625
92
0.726172
elishacloud
20e8467d9b10b31a3b54dec79147a02445d2219b
2,092
cpp
C++
src/test/TCAtl/RangeValueSlider.cpp
FreeAllegiance/AllegianceDX7
3955756dffea8e7e31d3a55fcf6184232b792195
[ "MIT" ]
76
2015-08-18T19:18:40.000Z
2022-01-08T12:47:22.000Z
src/test/TCAtl/RangeValueSlider.cpp
StudentAlleg/Allegiance
e91660a471eb4e57e9cea4c743ad43a82f8c7b18
[ "MIT" ]
37
2015-08-14T22:44:12.000Z
2020-01-21T01:03:06.000Z
src/test/TCAtl/RangeValueSlider.cpp
FreeAllegiance/Allegiance-AZ
1d8678ddff9e2efc79ed449de6d47544989bc091
[ "MIT" ]
42
2015-08-13T23:31:35.000Z
2022-03-17T02:20:26.000Z
///////////////////////////////////////////////////////////////////////////// // RangeValueSlider.cpp | Implementation of the TCRangeValueSlider class. #include "RangeValueSlider.h" ///////////////////////////////////////////////////////////////////////////// // TCRangeValueSlider ///////////////////////////////////////////////////////////////////////////// // Operations bool TCRangeValueSlider::Update(ULONG nObjects, ITCRangeValue** ppObjects) { // Enable/disable the controls if no objects or more than 1 object bool bEnable = (1 == nObjects); if (bEnable) { __try { // Get the object ITCRangeValue* pobj = ppObjects[0]; // Save the default value m_nValueDefault = pobj->DefaultValue; // Get the range of the value long nMin = pobj->MinValue; long nMax = pobj->MaxValue; long nSteps = nMax + 1 - nMin; // Set the tick frequency of the slider long nTickMarks = pobj->TickMarks; if (nTickMarks) { long nTickFreq = nSteps / pobj->TickMarks; SetTicFreq(nTickFreq); // Set the page size of the slider to be the same as the tick freq SetPageSize(nTickFreq); } else { ClearTics(); } // Set the line size of the slider long nGranularity = pobj->Granularity; SetLineSize(nGranularity); // Set the range of the slider SetRange(nMin, nMax, true); // Set the position of the slider long nValue = pobj->RangeValue; SetPos(nValue); } __except(1) { bEnable = false; } } // Enable/disable the window if no objects or more than 1 object EnableWindow(bEnable); // Returnt the enabled flag return bEnable; } HRESULT TCRangeValueSlider::Apply(ULONG nObjects, ITCRangeValue** ppObjects) { // Do nothing if no objects or more than 1 object if (1 != nObjects) return E_UNEXPECTED; // Get the object ITCRangeValue* pobj = ppObjects[0]; // Apply the slider setting to the object long nValue = GetPos(); return pobj->put_RangeValue(nValue); }
24.325581
77
0.5674
FreeAllegiance
20e8ef67bc739c95d3bc6e439d40a5872348b812
10,580
cpp
C++
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
#include "vulkan_memory_manager.hpp" #include <utility> #include "vulkan_utils.hpp" #include "vulkan_context.hpp" #include <iostream> namespace vk { //<f> Constructors & operator= VulkanMemoryManager::VulkanMemoryManager(VulkanContext* vulkan_context): m_vulkan_context{vulkan_context} { } VulkanMemoryManager::~VulkanMemoryManager() noexcept { // m_memory_blocks.clear(); m_vulkan_context = nullptr; } VulkanMemoryManager::VulkanMemoryManager(const VulkanMemoryManager& other) { } VulkanMemoryManager::VulkanMemoryManager(VulkanMemoryManager&& other) noexcept { } VulkanMemoryManager& VulkanMemoryManager::operator=(const VulkanMemoryManager& other) { if(this != &other)//not same ref { auto tmp(other); *this = std::move(tmp); } return *this; } VulkanMemoryManager& VulkanMemoryManager::operator=(VulkanMemoryManager&& other) noexcept { if(this != &other)//not same ref { //move here } return *this; } //</f> /Constructors & operator= //<f> Methods //<f> Buffer bool VulkanMemoryManager::RequestBuffer(VkDeviceSize buffer_size, VkBufferUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Buffer VkBufferCreateInfo buffer_create_info{}; buffer_create_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_create_info.pNext = nullptr; buffer_create_info.flags = 0; buffer_create_info.size = buffer_size; buffer_create_info.usage = usage_flags; buffer_create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; if( vkCreateBuffer(*m_vulkan_context->LogicalDevice(), &buffer_create_info, nullptr, &buffer->buffer) != VK_SUCCESS ) throw std::runtime_error("Failed to create vertex buffer"); //</f> /Create Buffer //<f> Request Memory block VkMemoryRequirements buffer_memory_requirements; vkGetBufferMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->buffer, &buffer_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(buffer_memory_requirements.memoryTypeBits, property_flags)}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_memory_blocks[key_pair]) { if(block.second.CreateBuffer(buffer_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < buffer_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateBuffer(buffer_memory_requirements, usage_flags, buffer); //store memory block m_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } void VulkanMemoryManager::DestroyBuffer(Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.ReleaseBuffer(buffer); } } void VulkanMemoryManager::MapMemory(Buffer* buffer, void **ppData, VkMemoryMapFlags flags) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.MapMemory(buffer, ppData, flags); } } void VulkanMemoryManager::UnmapMemory(Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.UnmapMemory(buffer); } } //</f> /Buffer //<f> Image bool VulkanMemoryManager::RequestImageBuffer(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Image VkImageCreateInfo create_info{vk::ImageCreateInfo()}; create_info.imageType = VK_IMAGE_TYPE_2D; create_info.extent.width = width; create_info.extent.height = height; create_info.extent.depth = 1; create_info.mipLevels = 1; create_info.arrayLayers = 1; create_info.format = format; create_info.tiling = tiling; create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; create_info.usage = usage_flags; // create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;//we will copy to it(transfer) and use it in shaders to colour the mesh(sampled) create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;//one queue at a time create_info.samples = VK_SAMPLE_COUNT_1_BIT; if( vkCreateImage(*m_vulkan_context->LogicalDevice(), &create_info, nullptr, &buffer->image) != VK_SUCCESS ) throw std::runtime_error("Failed to create image buffer"); //</f> /Create Image //<f> Request Memory block VkMemoryRequirements image_memory_requirements; vkGetImageMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->image, &image_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(image_memory_requirements.memoryTypeBits, property_flags)}; auto image_size{image_memory_requirements.size}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_image_memory_blocks[key_pair]) { if(block.second.CreateImageBuffer(image_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < image_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateImageBuffer(image_memory_requirements, usage_flags, buffer); //store memory block m_image_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } bool VulkanMemoryManager::RequestCubemapBuffer(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Image VkImageCreateInfo create_info{vk::ImageCreateInfo()}; create_info.imageType = VK_IMAGE_TYPE_2D; create_info.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; create_info.extent.width = width; create_info.extent.height = height; create_info.extent.depth = 1; create_info.mipLevels = 1; create_info.arrayLayers = 6;//6 faces of the cubemap create_info.format = format; create_info.tiling = tiling; create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; create_info.usage = usage_flags; // create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;//we will copy to it(transfer) and use it in shaders to colour the mesh(sampled) create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;//one queue at a time create_info.samples = VK_SAMPLE_COUNT_1_BIT; if( vkCreateImage(*m_vulkan_context->LogicalDevice(), &create_info, nullptr, &buffer->image) != VK_SUCCESS ) throw std::runtime_error("Failed to create image buffer"); //</f> /Create Image //<f> Request Memory block VkMemoryRequirements image_memory_requirements; vkGetImageMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->image, &image_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(image_memory_requirements.memoryTypeBits, property_flags)}; auto image_size{image_memory_requirements.size}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_image_memory_blocks[key_pair]) { if(block.second.CreateImageBuffer(image_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < image_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateImageBuffer(image_memory_requirements, usage_flags, buffer); //store memory block m_image_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } void VulkanMemoryManager::DestroyImageBuffer(ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_image_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.ReleaseImageBuffer(buffer); } } //</f> /Image void VulkanMemoryManager::Clear() { //memory block destructor will destroy the memory allocation m_memory_blocks.clear(); m_image_memory_blocks.clear(); } //</f> /Methods }//namespace
36.608997
208
0.727977
N4G170
20ebf22705922377c623c9c12bf9a36de894fcad
1,286
cpp
C++
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
#include <array> #include <string> #include "gtest/gtest.h" namespace { class Solution { public: [[nodiscard]] int canBeTypedWords(std::string const &text, std::string const &brokenLetters) const { constexpr size_t alphabetSize = 26; constexpr size_t alphabetStart = 'a'; std::array<bool, alphabetSize> brokenLettersData{}; brokenLettersData.fill(false); for (const char brokenLetter : brokenLetters) brokenLettersData[brokenLetter - alphabetStart] = true; size_t wordsCount = 0; size_t canType = true; for (const char ch : text) { if (ch == ' ') { wordsCount += (canType ? 1 : 0); canType = true; } else if (brokenLettersData[ch - alphabetStart]) canType = false; } wordsCount += (canType ? 1 : 0); return static_cast<int>(wordsCount); } }; } namespace MaxNumberOfWordsYouCanTypeTask { TEST(MaxNumberOfWordsYouCanTypeTaskTests, Examples) { const Solution solution; ASSERT_EQ(1, solution.canBeTypedWords("hello world", "ad")); ASSERT_EQ(1, solution.canBeTypedWords("leet code", "lt")); ASSERT_EQ(0, solution.canBeTypedWords("leet code", "e")); } }
25.72
102
0.604977
stdstring
20ed76c1f86d76d05998fd0e7408fb8f70d88752
452
cc
C++
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
2
2019-12-06T14:08:57.000Z
2020-01-15T15:25:32.000Z
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
1
2020-01-15T16:29:16.000Z
2020-01-26T12:40:13.000Z
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
null
null
null
class Solution { public: vector<int> grayCode(int n) { vector<int> result; result.push_back(0); if (n == 0) return result; for (int i = 0; i < n; i++) { // the left most bit int mask = 1 << i; int s = result.size(); while (s) { int num = mask | result[--s]; result.push_back(num); } } return result; } };
25.111111
45
0.415929
SMartQi
20f74baa01709f573a7d499f1c2b0c29e75497f7
5,588
cpp
C++
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
1
2021-05-09T01:24:05.000Z
2021-05-09T01:24:05.000Z
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
null
null
null
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
null
null
null
#include "kmain.h" #include "SkyTest.h" #include "PhysicalMemoryManager.h" #include "VirtualMemoryManager.h" #include "HeapManager.h" #include "HDDAdaptor.h" #include "RamDiskAdaptor.h" #include "FloppyDiskAdaptor.h" #include "StorageManager.h" #include "fileio.h" #include "SysAPI.h" #include "FPU.h" _declspec(naked) void multiboot_entry(void) { __asm { align 4 multiboot_header: //멀티부트 헤더 사이즈 : 0X20 dd(MULTIBOOT_HEADER_MAGIC); magic number dd(MULTIBOOT_HEADER_FLAGS); flags dd(CHECKSUM); checksum dd(HEADER_ADRESS); //헤더 주소 KERNEL_LOAD_ADDRESS+ALIGN(0x100064) dd(KERNEL_LOAD_ADDRESS); //커널이 로드된 가상주소 공간 dd(00); //사용되지 않음 dd(00); //사용되지 않음 dd(HEADER_ADRESS + 0x20); //커널 시작 주소 : 멀티부트 헤더 주소 + 0x20, kernel_entry kernel_entry: mov esp, KERNEL_STACK; //스택 설정 push 0; //플래그 레지스터 초기화 popf //GRUB에 의해 담겨 있는 정보값을 스택에 푸쉬한다. push ebx; //멀티부트 구조체 포인터 push eax; //매직 넘버 //위의 두 파라메터와 함께 kmain 함수를 호출한다. call kmain; //C++ 메인 함수 호출 //루프를 돈다. kmain이 리턴되지 않으면 아래 코드는 수행되지 않는다. halt: jmp halt; } } bool systemOn = false; uint32_t g_freeMemoryStartAddress = 0x00400000; //자유공간 시작주소 : 4MB uint32_t g_freeMemorySize = 0; void HardwareInitialize(); bool InitMemoryManager(multiboot_info* bootinfo); void ConstructFileSystem(); void kmain(unsigned long magic, unsigned long addr) { InitializeConstructors(); multiboot_info* pBootInfo = (multiboot_info*)addr; SkyConsole::Initialize(); //헥사를 표시할 때 %X는 integer, %x는 unsigned integer의 헥사값을 표시한다. SkyConsole::Print("*** Sky OS Console System Init ***\n"); SkyConsole::Print("GRUB Information\n"); SkyConsole::Print("Boot Loader Name : %s\n", (char*)pBootInfo->boot_loader_name); //kEnterCriticalSection(&g_criticalSection); HardwareInitialize(); SkyConsole::Print("Hardware Init Complete\n"); SetInterruptVector(); SkyConsole::Print("Interrput Handler Init Complete\n"); //물/가상 메모리 매니저를 초기화한다. //설정 시스템 메모리는 128MB InitMemoryManager(pBootInfo); SkyConsole::Print("Memory Manager Init Complete\n"); int heapFrameCount = 256 * 10 * 5; //프레임수 12800개, 52MB unsigned int requiredHeapSize = heapFrameCount * PAGE_SIZE; //요구되는 힙의 크기가 자유공간보다 크다면 그 크기를 자유공간 크기로 맞춘다음 반으로 줄인다. if (requiredHeapSize > g_freeMemorySize) { requiredHeapSize = g_freeMemorySize; heapFrameCount = requiredHeapSize / PAGE_SIZE / 2; } HeapManager::InitKernelHeap(heapFrameCount); SkyConsole::Print("Heap %dMB Allocated\n", requiredHeapSize / 1048576); /*if (false == InitFPU()) { SkyConsole::Print("[Warning] Floating Pointer Unit Detection Fail\n"); } else { EnableFPU(); SkyConsole::Print("FPU Init..\n"); }*/ InitKeyboard(); SkyConsole::Print("Keyboard Init..\n"); TestDebugging(); ConstructFileSystem(); for (;;); } void HardwareInitialize() { GDTInitialize(); IDTInitialize(0x8); PICInitialize(0x20, 0x28); InitializePIT(); } uint32_t GetFreeSpaceMemory(multiboot_info* bootinfo) { uint32_t memorySize = 0; uint32_t mmapEntryNum = bootinfo->mmap_length / sizeof(multiboot_memory_map_t); uint32_t mmapAddr = bootinfo->mmap_addr; #ifdef _SKY_DEBUG SkyConsole::Print("Memory Map Entry Num : %d\n", mmapEntryNum); #endif for (uint32_t i = 0; i < mmapEntryNum; i++) { multiboot_memory_map_t* entry = (multiboot_memory_map_t*)mmapAddr; #ifdef _SKY_DEBUG SkyConsole::Print("Memory Address : %x\n", entry->addr); SkyConsole::Print("Memory Length : %x\n", entry->len); SkyConsole::Print("Memory Type : %x\n", entry->type); SkyConsole::Print("Entry Size : %d\n", entry->size); #endif mmapAddr += sizeof(multiboot_memory_map_t); if (entry->addr + entry->len < g_freeMemoryStartAddress) continue; if (memorySize > entry->len) continue; memorySize = entry->len; if (entry->addr < g_freeMemoryStartAddress) memorySize -= (g_freeMemoryStartAddress - entry->addr); else g_freeMemoryStartAddress = entry->addr; } memorySize -= (memorySize % 4096); return memorySize; } bool InitMemoryManager(multiboot_info* bootinfo) { PhysicalMemoryManager::EnablePaging(false); g_freeMemorySize = GetFreeSpaceMemory(bootinfo); //물리 메모리 매니저 초기화 PhysicalMemoryManager::Initialize(g_freeMemorySize, g_freeMemoryStartAddress); //PhysicalMemoryManager::Dump(); //가상 메모리 매니저 초기화 VirtualMemoryManager::Initialize(); //PhysicalMemoryManager::Dump(); SkyConsole::Print("Free Memory Start Address(0x%x)\n", g_freeMemoryStartAddress); SkyConsole::Print("Free Memory Size(%dMB)\n", g_freeMemorySize / 1048576); return true; } void ConstructFileSystem() { //IDE 하드 디스크 /*FileSysAdaptor* pHDDAdaptor = new HDDAdaptor("HardDisk", 'C'); pHDDAdaptor->Initialize(); if (pHDDAdaptor->GetCount() > 0) { StorageManager::GetInstance()->RegisterFileSystem(pHDDAdaptor, 'C'); StorageManager::GetInstance()->SetCurrentFileSystemByID('C'); //TestHardDisk(); } else { delete pHDDAdaptor; }*/ //램 디스크 FileSysAdaptor* pRamDiskAdaptor = new RamDiskAdaptor("RamDisk", 'K'); if (pRamDiskAdaptor->Initialize() == true) { StorageManager::GetInstance()->RegisterFileSystem(pRamDiskAdaptor, 'K'); StorageManager::GetInstance()->SetCurrentFileSystemByID('K'); ((RamDiskAdaptor*)pRamDiskAdaptor)->InstallPackage(); } else { delete pRamDiskAdaptor; } //플로피 디스크 /*FileSysAdaptor* pFloppyDiskAdaptor = new FloppyDiskAdaptor("FloppyDisk", 'A'); if (pFloppyDiskAdaptor->Initialize() == true) { StorageManager::GetInstance()->RegisterFileSystem(pFloppyDiskAdaptor, 'A'); StorageManager::GetInstance()->SetCurrentFileSystemByID('A'); } else { delete pFloppyDiskAdaptor; } */ }
23.677966
82
0.717788
arkiny
20fbc0d91e7c0a548a83816a1f209b4ea6619a0f
752
cpp
C++
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
2
2021-06-12T02:55:28.000Z
2021-07-04T22:25:38.000Z
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
null
null
null
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
1
2021-07-04T22:28:38.000Z
2021-07-04T22:28:38.000Z
// Check Prime or Not using Class #include<iostream> using namespace std; class CodesCracker { private: int num, i, chk; public: int getData(); int checkPrimeNumber(int); }; int CodesCracker::getData() { cout<<"Enter a Number: "; cin>>num; return num; } int CodesCracker::checkPrimeNumber(int num) { int i, chk=0; for(i=2; i<num; i++) { if(num%i==0) { chk++; return chk; } } return chk; } int main() { CodesCracker c; int num, chk=0; num = c.getData(); chk = c.checkPrimeNumber(num); if(chk==0) cout<<"\nIt is a Prime Number"; else cout<<"\nIt is not a Prime Number"; cout<<endl; return 0; }
17.090909
43
0.530585
EarthMan123
20fc08c093597e22303de20bf328bb218667f8bb
870
hpp
C++
library/ATF/_starting_vote_inform_zoclInfo.hpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
library/ATF/_starting_vote_inform_zoclInfo.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
library/ATF/_starting_vote_inform_zoclInfo.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <_starting_vote_inform_zocl.hpp> START_ATF_NAMESPACE namespace Info { using _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_ptr = void (WINAPIV*)(struct _starting_vote_inform_zocl*); using _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_clbk = void (WINAPIV*)(struct _starting_vote_inform_zocl*, _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_ptr); using _starting_vote_inform_zoclsize4_ptr = int (WINAPIV*)(struct _starting_vote_inform_zocl*); using _starting_vote_inform_zoclsize4_clbk = int (WINAPIV*)(struct _starting_vote_inform_zocl*, _starting_vote_inform_zoclsize4_ptr); }; // end namespace Info END_ATF_NAMESPACE
48.333333
196
0.803448
lemkova
20fdeada0b93f5682ce471d92f56cbbefed44f3e
5,954
cpp
C++
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
1
2015-07-23T00:26:23.000Z
2015-07-23T00:26:23.000Z
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
null
null
null
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
null
null
null
/* * Copyright (c) 2012 Tom Alexander, Tate Larsen * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ #include "coordinate_system.h" #include "panda_node.h" #include <sstream> using std::stringstream; namespace { void negate_v(topaz::panda_node* node) { for (topaz::panda_node* child : node->children) { if (child->tag == "V") { stringstream inp(child->content); stringstream out; float tmp; while (inp >> tmp) { out << -tmp << " "; } child->content = out.str(); } } } void inverse_v(topaz::panda_node* node) { for (topaz::panda_node* child : node->children) { if (child->tag == "V") { stringstream inp(child->content); stringstream out; float tmp; while (inp >> tmp) { out << 1.0f/tmp << " "; } child->content = out.str(); } } } } namespace topaz { extern glm::mat4 fix_z_up_matrix; void assign_coordinate_system(panda_node* node, coordinate_system system) { node->coordinate_system = system; for (panda_node* child : node->children) assign_coordinate_system(child, system); } coordinate_system detect_coordinate_system(panda_node* node) { if (node->coordinate_system != UNASSIGNED) return node->coordinate_system; std::list<panda_node*> queue; queue.push_back(node); while (!queue.empty()) { panda_node* current = queue.front(); queue.pop_front(); for (panda_node* child : current->children) queue.push_back(child); if (current->tag == "CoordinateSystem") { if (current->content == "Z-Up") { assign_coordinate_system(node, ZUP); return ZUP; } else if (current->content == "Y-Up") { assign_coordinate_system(node, YUP); return YUP; } } } assign_coordinate_system(node, ZUP); return ZUP; } void fix_coordinate_system(panda_node* top) { std::list<panda_node*> queue; queue.push_back(top); while (!queue.empty()) { panda_node* node = queue.front(); queue.pop_front(); for (panda_node* child : node->children) queue.push_back(child); coordinate_system system = detect_coordinate_system(node); if (node->tag == "Matrix4") { stringstream tmp(node->content); glm::mat4 mat(1.0f); for (int i = 0; i < 16; ++i) { float x; tmp >> x; mat[i%4][i/4] = x; } mat = glm::transpose(mat); stringstream out; for (int i = 0; i < 16; ++i) { out << mat[i%4][i/4] << " "; } node->content = out.str(); } if (node->tag == "Char*" && node->name == "order") { std::reverse(node->content.begin(), node->content.end()); if (system == ZUP) { size_t hpos = node->content.find('h'); size_t rpos = node->content.find('r'); if (hpos != string::npos) { node->content[hpos] = 'r'; } if (rpos != string::npos) { node->content[rpos] = 'h'; } } } if (node->tag == "S$Anim") { if (node->name == "r") { if (system == ZUP) node->name = "h"; negate_v(node); } else if (system == ZUP && node->name == "h") { node->name = "r"; } // else if (system == ZUP && node->name == "j") // { // node->name = "k"; // } // else if (system == ZUP && node->name == "k") // { // negate_v(node); // node->name = "j"; // } // else if (system == ZUP && node->name == "y") // { // node->name = "z"; // } // else if (system == ZUP && node->name == "z") // { // negate_v(node); // node->name = "y"; // } } } } }
31.336842
80
0.433322
tomalexander
20feca9f22ac9481e2e2bb9a016dff751212252d
5,165
cpp
C++
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
#include "WindowsConsole.h" #include "Xuzumi/Core/Debug/InternalAssertion.h" #include "Xuzumi/Platform.Windows/Debug/HrDebug.h" #include <cstdio> #include <Windows.h> #include <Shobjidl.h> namespace Xuzumi { namespace { UINT convertForegroundConsoleColor_(ConsoleColor color) { UINT colorFlags = 0u; switch (color) { case ConsoleColor::White: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::Black: break; case ConsoleColor::Blue: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::Red: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; break; case ConsoleColor::Green: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::Yello: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::DarkWhite: colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::DarkBlue: colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::DarkRed: colorFlags |= FOREGROUND_RED; break; case ConsoleColor::DarkGreen: colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::DarkYello: colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; break; } return colorFlags; } UINT convertBackgroundConsoleColor_(ConsoleColor color) { UINT colorFlags = 0u; switch (color) { case ConsoleColor::White: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::Black: break; case ConsoleColor::Blue: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::Red: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; break; case ConsoleColor::Green: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::Yello: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::DarkWhite: colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::DarkBlue: colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::DarkRed: colorFlags |= BACKGROUND_RED; break; case ConsoleColor::DarkGreen: colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::DarkYello: colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; break; } return colorFlags; } } bool Console::Allocate() { Free(); s_instance = new WindowsConsole(); if (!s_instance->Valid_()) { Free(); return false; } return true; } WindowsConsole::WindowsConsole() { AllocWindowsConsole(); } WindowsConsole::~WindowsConsole() { FreeWindowsConsole(); } bool WindowsConsole::Valid_() const { return m_valid; } void WindowsConsole::SetBackgroundColor_(ConsoleColor color) { SetConsoleTextAttribute(m_consoleHandle, convertBackgroundConsoleColor_(color)); } void WindowsConsole::SetForegroundColor_(ConsoleColor color) { SetConsoleTextAttribute(m_consoleHandle, convertForegroundConsoleColor_(color)); } void WindowsConsole::AllocWindowsConsole() { m_valid = AllocConsole(); checkLastHr().LogFailure(); if (!m_valid) return; FILE* ioJob = nullptr; freopen_s(&ioJob, "CONIN$", "r", stdin); freopen_s(&ioJob, "CONOUT$", "w", stdout); freopen_s(&ioJob, "CONOUT$", "w", stderr); m_consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); HWND consoleWindow = GetConsoleWindow(); EnableMenuItem(GetSystemMenu(consoleWindow, false), SC_CLOSE, MF_DISABLED); RemoveFromTaskbar(); } void WindowsConsole::FreeWindowsConsole() { HWND consoleWindow = GetConsoleWindow(); FreeConsole(); checkLastHr().LogFailure(); SendMessageA(consoleWindow, WM_CLOSE, 0, 0); m_valid = false; m_consoleHandle = nullptr; } void WindowsConsole::RemoveFromTaskbar() { HRESULT hr = CoInitialize(nullptr); checkHr(hr).LogFailure(); ITaskbarList* taskbar = nullptr; hr = CoCreateInstance( CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, (void**)&taskbar); checkHr(hr).LogFailure(); if (FAILED(hr) || nullptr == taskbar) { XZ_CORE_ASSERT(false, "Cannot remove console window from task bar." " Closing the console window may result into undefined behaviour"); return; } hr = taskbar->DeleteTab(GetConsoleWindow()); checkHr(hr).LogFailure(); taskbar->Release(); if (FAILED(hr)) { XZ_CORE_ASSERT(false, "Cannot remove console window from task bar." " Closing the console window may result into undefined behaviour"); return; } return CoUninitialize(); } }
22.167382
77
0.700097
lymuc-studio
20ff4e05e7f7bdfad3644345adf591f1adb55a60
2,603
cpp
C++
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
4
2015-09-13T09:04:29.000Z
2016-08-21T22:12:59.000Z
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
null
null
null
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
null
null
null
// // Copyright (c) 2015 Gustavo Valiente [email protected] // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #include "trjsequenceaction.h" #include "trjdebug.h" namespace trj { SequenceAction::SequenceAction(std::vector<Ptr<Action>>&& actions, bool forward) : mActions(std::move(actions)), mForward(forward) { TRJ_ASSERT(! mActions.empty(), "Actions vector is empty"); #ifdef TRJ_DEBUG for(const auto& action : mActions) { TRJ_ASSERT(action.get(), "Action is empty"); } #endif if(forward) { mIndex = 0; } else { mIndex = mActions.size() - 1; } } bool SequenceAction::run(float elapsedTime, Node& node) { auto& action = mActions[mIndex]; if(action->run(elapsedTime, node)) { if(mForward) { ++mIndex; if(mIndex == (int) mActions.size()) { return true; } } else { --mIndex; if(mIndex < 0) { return true; } } } return false; } Ptr<SequenceAction> SequenceAction::getSequenceClone() const { std::vector<Ptr<Action>> actions; actions.reserve(mActions.size()); for(const auto& action : mActions) { actions.push_back(action->getClone()); } return Ptr<SequenceAction>(new SequenceAction(std::move(actions), mForward)); } Ptr<SequenceAction> SequenceAction::getSequenceReversed() const { std::vector<Ptr<Action>> actions; actions.reserve(mActions.size()); for(const auto& action : mActions) { actions.push_back(action->getReversed()); } return Ptr<SequenceAction>(new SequenceAction(std::move(actions), ! mForward)); } }
25.519608
83
0.633116
GValiente
1f020fbbe19230c161940500849d1f2777756ac2
881
hpp
C++
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2019-10-29T09:36:18.000Z
2020-08-17T08:31:37.000Z
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2020-04-24T20:02:56.000Z
2020-10-14T10:07:18.000Z
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2020-01-29T05:36:03.000Z
2020-05-31T06:48:52.000Z
// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: Copyright 2019-2022 Heal Research #ifndef OPERON_OPERATOR_HPP #define OPERON_OPERATOR_HPP #include "types.hpp" namespace Operon { template <typename Ret, typename... Args> struct OperatorBase { using ReturnType = Ret; using ArgumentType = std::tuple<Args...>; // all operators take a random device (source of randomness) as the first parameter virtual auto operator()(Operon::RandomGenerator& random, Args... args) const -> Ret = 0; virtual ~OperatorBase() = default; OperatorBase() = default; OperatorBase(OperatorBase const& other) = default; OperatorBase(OperatorBase&& other) noexcept = default; auto operator=(OperatorBase const& other) -> OperatorBase& = default; auto operator=(OperatorBase&& other) noexcept -> OperatorBase& = default; }; } // namespace Operon #endif
31.464286
92
0.724177
ivor-dd
1f068f97526b1f11a9c7796cab8c6735efb4f176
2,095
cpp
C++
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
#include "chokoengine.hpp" CE_BEGIN_NAMESPACE _FrameBufferCube::_FrameBufferCube(uint r, std::vector<GLenum> types, int div) : _maps(types.size(), nullptr), _depth(nullptr), _lastUpdated(0) { std::vector<GLenum> bufs(types.size()); for (size_t a = 0; a < types.size(); a++) { _maps[a] = CubeMap::New(r, types[a], TextureOptions( TextureWrap::Clamp, TextureWrap::Clamp, div, true ), 0); bufs[a] = GL_COLOR_ATTACHMENT0 + (GLsizei)a; } _depth = DepthCubeMap_New(r); for (int f = 0; f < 6; f++) { GLuint fbo; glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); for (size_t a = 0; a < types.size(); a++) { glFramebufferTexture2D(GL_FRAMEBUFFER, bufs[a], GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, _maps[a]->_pointer, 0); } glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, _depth->_pointer, 0); glDrawBuffers((GLsizei)bufs.size(), bufs.data()); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { Debug::Error("FrameBuffer", "gl error " + std::to_string(status)); } //we have to use fromptr to construct from private function //this is not good design-wise, but will do for now //pass null textures to prevent double cleanup _pointers[f] = RenderTarget::FromPtr(new _RenderTarget(_depth->_reso, _depth->_reso, 0, 0, fbo)); } _tmpPointer = RenderTarget::New(_depth->_reso, _depth->_reso, true, true); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } const CubeMap& _FrameBufferCube::map(int i) { return _maps[i]; } void _FrameBufferCube::Clear() const { float zeros[4] = {}; float one = 1; for (int a = 0; a < _maps.size(); a++) { glClearBufferfv(GL_COLOR, a, zeros); } glClearBufferfv(GL_DEPTH, 0, &one); } void _FrameBufferCube::Bind(CubeMapFace f) const { _pointers[(int)f]->BindTarget(); } void _FrameBufferCube::Unbind() const { glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } FrameBufferCube FrameBufferCube_New(uint r, std::vector<GLenum> types) { return std::make_shared<_FrameBufferCube>(r, types); } CE_END_NAMESPACE
32.734375
119
0.713604
chokomancarr
1f0837174b1e9d05cd8e27dfb723a47c5ac5b268
2,501
cpp
C++
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
#include "CommandCombat.h" #include <boost/algorithm/string.hpp> void CommandCombat::executeInHeartbeat(const std::string& username, const std::vector<std::string>& fullCommand) { auto& combatManager = characterManager.getCombatManager(); auto& currentCombat = combatManager.getCombatWithPlayer(username); if(currentCombat.hasPlayer(username)){ onlineUserManager.addMessageToUser(username, "One of you are already in a combat!\n"); } auto& firstCommand = fullCommand.at(1); if(firstCommand == "challenge"){ auto& challengedName = fullCommand.at(2); if(combatManager.createInvite(username, challengedName)){ onlineUserManager.addMessageToUser(username, "Waiting for " + challengedName +" to accept challenge.\n"); onlineUserManager.addMessageToUser(challengedName, "You were challenged to combat by " + username +".\n"); } }else if(firstCommand == "join" || firstCommand == "accept"){ if(combatManager.confirmInvite(username)){ combatManager.removeInvite(username); currentCombat = combatManager.getCombatWithPlayer(username); auto opponentName = currentCombat.getOpponent(username); onlineUserManager.addMessageToUser(username, "joined combat with " + opponentName + ".\n"); onlineUserManager.addMessageToUser(opponentName, username + " accepted your challenge.\n"); } else { onlineUserManager.addMessageToUser(username, "You have not been challenged to combat.\n"); } } } std::vector<std::string> CommandCombat::reassembleCommand(std::string& fullCommand, bool& commandIsValid) { std::vector<std::string> processedCommand; //Format: combat challenge [username] //Format: combat accept //Format: combat accept [username] //Format: combat join [username] boost::trim_if(fullCommand, boost::is_any_of(" \t")); //split by " " boost::split(processedCommand, fullCommand, boost::is_any_of(" \t"), boost::token_compress_on); if(processedCommand.size() == 2) { commandIsValid = (processedCommand[1] == "accept"); } else if(processedCommand.size() == 3) { //reassemble the command commandIsValid = (processedCommand[1] == "accept" || processedCommand[1] == "join" || processedCommand[1] == "challenge"); } else { commandIsValid = false; } return processedCommand; }
44.660714
118
0.661335
ica778
1f0d6a327fbd20e3f2c972e17737883cc64eda60
8,904
cpp
C++
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
191
2015-01-04T17:17:00.000Z
2022-03-30T22:59:31.000Z
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
28
2015-01-06T01:16:25.000Z
2020-11-26T14:46:14.000Z
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
18
2015-01-26T21:33:31.000Z
2021-12-21T05:33:24.000Z
/* * Copyright (c) 2013, Kelvin W Sherlock * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "mpw.h" #include "mpw_internal.h" #include "mpw_errno.h" #include <algorithm> #include <memory> #include <string> #include <stdexcept> #include <cstdio> #include <cstring> #include <cerrno> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/paths.h> #include <cpu/defs.h> #include <cpu/fmem.h> #include <cpu/CpuModule.h> #include <macos/errors.h> #include <toolbox/os.h> #include <toolbox/os_internal.h> using MacOS::macos_error_from_errno; namespace MPW { uint32_t ftrap_dup(uint32_t parm, uint32_t arg) { uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" dup(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [](int fd, OS::Internal::FDEntry &e){ e.refcount++; return 0; }, [](int fd){ return kEINVAL; } ); #if 0 try { auto &e = OS::Internal::FDTable.at(fd); if (e.refcount) { d0 = 0; fd.refcount++; } else { d0 = kEINVAL; } } catch(std::out_of_range &ex) { d0 = kEINVAL; } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_bufsize(uint32_t parm, uint32_t arg) { // should return the preferred buffsize in *arg // an error will use the default size (0x400 bytes). MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" bufsize(%02x)\n", fd); memoryWriteWord(f.error, parm + 2); return kEINVAL; } uint32_t ftrap_interactive(uint32_t parm, uint32_t arg) { // return 0 if interactive, an error if // non-interactive. uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); // linkgs reads from stdin and // doesn't work quite right when // this returns 0. So, don't. f.error = 0; int fd = f.cookie; Log(" interactive(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [](int fd, OS::Internal::FDEntry &e){ int tty = ::isatty(fd); return tty ? 0 : kEINVAL; }, [](int fd){ return kEINVAL; } ); #if 0 try { auto &e = OS::Internal::FDTable.at(fd); if (e.refcount) { int tty = ::isatty(fd); d0 = tty ? 0 : kEINVAL; } else { d0 = kEINVAL; } } catch(std::out_of_range &ex) { d0 = kEINVAL; } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_fname(uint32_t parm, uint32_t arg) { // return file name. // AsmIIgs uses this... MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" fname(%02x)\n", fd); memoryWriteWord(f.error, parm + 2); return kEINVAL; } uint32_t ftrap_refnum(uint32_t parm, uint32_t arg) { // returns the refnum in *arg uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" refnum(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [arg](int fd, OS::Internal::FDEntry &e){ memoryWriteWord(fd, arg); return 0; }, [](int fd){ return kEINVAL; } ); #if 0 if (fd < 0 || fd >= FDTable.size() || !FDTable[fd]) { d0 = kEINVAL; } else { d0 = 0; memoryWriteWord(fd, arg); } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_lseek(uint32_t parm, uint32_t arg) { MPWFile f; uint32_t d0; uint32_t whence = memoryReadLong(arg); int32_t offset = memoryReadLong(arg + 4); // signed value. int nativeWhence = 0; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); int fd = f.cookie; /* * LinkIIgs does a seek on stdin. If it doesn't cause an * error, then it attempts to read a list of files from stdin, * which causes problems. * (Get_Standard_Input -> fseek -> lseek -> ioctl ) * to compensate, error out if isatty. */ // TODO - MacOS returns eofERR and sets mark to eof // if seeking past the eof. switch (whence) { case kSEEK_CUR: nativeWhence = SEEK_CUR; break; case kSEEK_END: nativeWhence = SEEK_END; break; case kSEEK_SET: nativeWhence = SEEK_SET; break; default: memoryWriteWord(0, parm + 2); return kEINVAL; } Log(" lseek(%02x, %08x, %02x)\n", fd, offset, nativeWhence); if (::isatty(fd)) { off_t rv = -1; d0 = kEINVAL; f.error = 0; memoryWriteLong(rv, arg + 4); memoryWriteWord(f.error, parm + 2); return d0; } off_t rv = ::lseek(fd, offset, nativeWhence); if (rv < 0) { d0 = mpw_errno_from_errno(); f.error = macos_error_from_errno(); //perror(NULL); } else { d0 = 0; f.error = 0; } memoryWriteLong(rv, arg + 4); memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_seteof(uint32_t parm, uint32_t arg) { uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" seteof(%02x, %08x)\n", fd, arg); d0 = OS::Internal::FDEntry::action(fd, [arg, &f](int fd, OS::Internal::FDEntry &e){ int ok = ftruncate(fd, arg); if (ok == 0) return 0; f.error = macos_error_from_errno(); return (int)mpw_errno_from_errno(); }, [](int fd){ return kEINVAL; } ); memoryWriteWord(f.error, parm + 2); return d0; } void ftrap_ioctl(uint16_t trap) { // returns an mpw_errno in d0 [???] // int ioctl(int fildes, unsigned int cmd, long *arg); uint32_t d0; uint32_t sp = cpuGetAReg(7); uint32_t fd = memoryReadLong(sp + 4); uint32_t cmd = memoryReadLong(sp + 8); uint32_t arg = memoryReadLong(sp + 12); Log("%04x IOCtl(%08x, %08x, %08x)\n", trap, fd, cmd, arg); switch (cmd) { case kFIOLSEEK: d0 = ftrap_lseek(fd, arg); break; case kFIODUPFD: d0 = ftrap_dup(fd, arg); break; case kFIOBUFSIZE: d0 = ftrap_bufsize(fd, arg); break; case kFIOINTERACTIVE: d0 = ftrap_interactive(fd, arg); break; case kFIOFNAME: d0 = ftrap_fname(fd, arg); break; case kFIOREFNUM: d0 = ftrap_refnum(fd, arg); break; case kFIOSETEOF: d0 = ftrap_seteof(fd, arg); break; default: fprintf(stderr, "ioctl - unsupported op %04x\n", cmd); exit(1); break; } cpuSetDReg(0, d0); } }
19.919463
82
0.636119
tsupplis
1f15f8db8541780972f18bac14cdfb549498b72d
2,983
cpp
C++
components/raisedbutton.cpp
ashraf-kx/qt-material-widgets
851d3fb7b56695a9181e3ea373f3d9e4015c15df
[ "BSD-3-Clause" ]
5
2018-09-13T16:18:03.000Z
2022-03-16T07:34:21.000Z
components/raisedbutton.cpp
ashraf-kx/qt-material-widgets
851d3fb7b56695a9181e3ea373f3d9e4015c15df
[ "BSD-3-Clause" ]
null
null
null
components/raisedbutton.cpp
ashraf-kx/qt-material-widgets
851d3fb7b56695a9181e3ea373f3d9e4015c15df
[ "BSD-3-Clause" ]
2
2022-02-22T04:08:50.000Z
2022-03-12T10:05:15.000Z
#include "raisedbutton_p.h" namespace md { /*! * \class QtMaterialRaisedButtonPrivate * \internal */ /*! * \internal */ RaisedButtonPrivate::RaisedButtonPrivate(RaisedButton *q) : FlatButtonPrivate(q) { } /*! * \internal */ RaisedButtonPrivate::~RaisedButtonPrivate() { } /*! * \internal */ void RaisedButtonPrivate::init() { Q_Q(RaisedButton); shadowStateMachine = new QStateMachine(q); normalState = new QState; pressedState = new QState; effect = new QGraphicsDropShadowEffect; effect->setBlurRadius(7); effect->setOffset(QPointF(0, 2)); effect->setColor(QColor(0, 0, 0, 75)); q->setBackgroundMode(Qt::OpaqueMode); q->setMinimumHeight(42); q->setGraphicsEffect(effect); q->setBaseOpacity(0.3); shadowStateMachine->addState(normalState); shadowStateMachine->addState(pressedState); normalState->assignProperty(effect, "offset", QPointF(0, 2)); normalState->assignProperty(effect, "blurRadius", 7); pressedState->assignProperty(effect, "offset", QPointF(0, 5)); pressedState->assignProperty(effect, "blurRadius", 29); QAbstractTransition *transition; transition = new QEventTransition(q, QEvent::MouseButtonPress); transition->setTargetState(pressedState); normalState->addTransition(transition); transition = new QEventTransition(q, QEvent::MouseButtonDblClick); transition->setTargetState(pressedState); normalState->addTransition(transition); transition = new QEventTransition(q, QEvent::MouseButtonRelease); transition->setTargetState(normalState); pressedState->addTransition(transition); QPropertyAnimation *animation; animation = new QPropertyAnimation(effect, "offset", q); animation->setDuration(100); shadowStateMachine->addDefaultAnimation(animation); animation = new QPropertyAnimation(effect, "blurRadius", q); animation->setDuration(100); shadowStateMachine->addDefaultAnimation(animation); shadowStateMachine->setInitialState(normalState); shadowStateMachine->start(); } /*! * \class QtMaterialRaisedButton */ RaisedButton::RaisedButton(QWidget *parent) : FlatButton(*new RaisedButtonPrivate(this), parent) { d_func()->init(); } RaisedButton::RaisedButton(const QString &text, QWidget *parent) : FlatButton(*new RaisedButtonPrivate(this), parent) { d_func()->init(); setText(text); } RaisedButton::~RaisedButton() { } RaisedButton::RaisedButton(RaisedButtonPrivate &d, QWidget *parent) : FlatButton(d, parent) { d_func()->init(); } bool RaisedButton::event(QEvent *event) { Q_D(RaisedButton); if (QEvent::EnabledChange == event->type()) { if (isEnabled()) { d->shadowStateMachine->start(); d->effect->setEnabled(true); } else { d->shadowStateMachine->stop(); d->effect->setEnabled(false); } } return FlatButton::event(event); } }
23.304688
70
0.684211
ashraf-kx
1f17a00fc05e94477d5bb3428d939891fdb66ae5
1,259
hpp
C++
code/src/engine/physics/helper_physx.hpp
shossjer/fimbulwinter
d894e4bddb5d2e6dc31a8112d245c6a1828604e3
[ "0BSD" ]
3
2020-04-29T14:55:58.000Z
2020-08-20T08:43:24.000Z
code/src/engine/physics/helper_physx.hpp
shossjer/fimbulwinter
d894e4bddb5d2e6dc31a8112d245c6a1828604e3
[ "0BSD" ]
1
2022-03-12T11:37:46.000Z
2022-03-12T20:17:38.000Z
code/src/engine/physics/helper_physx.hpp
shossjer/fimbulwinter
d894e4bddb5d2e6dc31a8112d245c6a1828604e3
[ "0BSD" ]
null
null
null
#ifndef ENGINE_PHYSICS_HELPER_PHYSX_HPP #define ENGINE_PHYSICS_HELPER_PHYSX_HPP #include <PxPhysicsAPI.h> #include <core/maths/Vector.hpp> /** * \note Should be used by physics implementation only. */ namespace engine { namespace physics { template<class T> inline T convert(const core::maths::Vector3f val) { core::maths::Vector3f::array_type buffer; val.get_aligned(buffer); return T {buffer[0], buffer[1], buffer[2]}; } inline physx::PxQuat convert(const core::maths::Quaternionf val) { core::maths::Quaternionf::array_type buffer; val.get_aligned(buffer); return physx::PxQuat { buffer[1], buffer[2], buffer[3], buffer[0] }; } inline core::maths::Quaternionf convert(const physx::PxQuat val) { return core::maths::Quaternionf {val.w, val.x, val.y, val.z}; } inline core::maths::Vector3f convert(const physx::PxVec3 val) { return core::maths::Vector3f {val.x, val.y, val.z}; } inline core::maths::Vector3f convert(const physx::PxTransform val) { return core::maths::Vector3f {val.p.x, val.p.y, val.p.z}; } inline core::maths::Vector3f convert(const physx::PxExtendedVec3 val) { return core::maths::Vector3f {(float) val.x, (float) val.y, (float) val.z}; } } } #endif /* ENGINE_PHYSICS_HELPER_PHYSX_HPP */
23.314815
77
0.709293
shossjer
1f1a52d230d41f4071da52d70426260c3af197cc
1,377
hpp
C++
lib/graph/chromatic_number.hpp
kuhaku-space/atcoder-lib
7fe1365e1be69d3eff11e122b2c7dff997a6c541
[ "Apache-2.0" ]
null
null
null
lib/graph/chromatic_number.hpp
kuhaku-space/atcoder-lib
7fe1365e1be69d3eff11e122b2c7dff997a6c541
[ "Apache-2.0" ]
4
2022-01-05T14:40:40.000Z
2022-03-05T08:03:19.000Z
lib/graph/chromatic_number.hpp
kuhaku-space/atcoder-lib
7fe1365e1be69d3eff11e122b2c7dff997a6c541
[ "Apache-2.0" ]
null
null
null
#include "graph/matrix_graph.hpp" #include "template/template.hpp" // 彩色数を求める // O(2^N) int chromatic_number(const matrix_graph<bool> &G) { constexpr int64_t _MOD = (1LL << 31) - 1; int n = G.size(); vector<int> neighbor(n, 0); for (int i = 0; i < n; ++i) { int s = 1 << i; for (int j = 0; j < n; ++j) { if (G[i][j]) s |= 1 << j; } neighbor[i] = s; } vector<int> v(1 << n); v[0] = 1; for (int s = 1; s < 1 << n; ++s) { int c = __builtin_ctz(s); v[s] = v[s & ~(1 << c)] + v[s & ~neighbor[c]]; } auto _mod = [](int64_t a) -> int64_t { a = (a & _MOD) + (a >> 31); return a >= _MOD ? a - _MOD : a; }; auto _pow = [](auto f, int64_t a, int n) { int64_t res = 1; for (; n > 0; n >>= 1) { if (n & 1) res = f(res * a); a = f(a * a); } return res; }; int low = 0, high = n; while (high - low > 1) { int mid = (low + high) >> 1; int64_t g = 0; for (int s = 0; s < 1 << n; ++s) { if ((n - __builtin_popcount(s)) & 1) g = _mod(g + _MOD - _pow(_mod, v[s], mid)); else g = _mod(g + _pow(_mod, v[s], mid)); } if (g != 0) high = mid; else low = mid; } return high; }
27
93
0.394336
kuhaku-space
1f1e93e0df42d30a99c04fc4bf35157a42a2abe7
2,428
cpp
C++
registerwidget/borrowerregister.cpp
winthegame9/cpp-libsystem
4346dbb1aa22464e1ce26d8f3f53311411eac9f3
[ "Apache-2.0" ]
null
null
null
registerwidget/borrowerregister.cpp
winthegame9/cpp-libsystem
4346dbb1aa22464e1ce26d8f3f53311411eac9f3
[ "Apache-2.0" ]
null
null
null
registerwidget/borrowerregister.cpp
winthegame9/cpp-libsystem
4346dbb1aa22464e1ce26d8f3f53311411eac9f3
[ "Apache-2.0" ]
null
null
null
#include "borrowerregister.h" #include "ui_borrowerregister.h" #include "dialogs/persondialog.h" #include <QMessageBox> #include <QDebug> BorrowerRegister::BorrowerRegister(QWidget *parent) : QWidget(parent), ui(new Ui::BorrowerRegister) { ui->setupUi(this); listModel = new PersonListModel(lib::Borrower, this); ui->listView->setModel(listModel); setDeregisterButtonEnabled(false); connect(this, &BorrowerRegister::itemInsert, listModel, &PersonListModel::whenItemInserted); connect(this, &BorrowerRegister::itemUpdate, listModel, &PersonListModel::whenItemUpdated); } BorrowerRegister::~BorrowerRegister() { delete ui; } void BorrowerRegister::setDeregisterButtonEnabled(bool enable) { ui->buttonDeregister->setEnabled(enable); } lib::Person BorrowerRegister::getCurrent() const { return current; } void BorrowerRegister::loadFromDB(QVector<lib::Person> items) { if(items.size() > 0) { qDebug() << "loading borrowers from database"; listModel->loadFromDB(items); } qDebug() << "no borrowers from database"; } void BorrowerRegister::on_listView_clicked(const QModelIndex &index) { current = index.data(Qt::UserRole).value<lib::Person>(); if(current.getDeregistered().isValid()) { setDeregisterButtonEnabled(false); } else { setDeregisterButtonEnabled(true); } emit itemSelectionChanged(current); } void BorrowerRegister::on_buttonRegister_clicked() { // create a dialog for role lib::Borrower PersonDialog dialog(lib::Borrower, this); connect(&dialog, &PersonDialog::personCreated, this, &BorrowerRegister::whenPersonCreated); dialog.exec(); } void BorrowerRegister::on_buttonDeregister_clicked() { QMessageBox::StandardButton reply; reply = QMessageBox::question(this, tr("Deregister person"), tr("Deregister selected person?"), QMessageBox::Yes | QMessageBox::No); if(reply == QMessageBox::Yes) { current.setDeregistered(QDate::currentDate()); setDeregisterButtonEnabled(false); emit itemUpdate(current); } } void BorrowerRegister::whenPersonCreated(lib::Person person) { emit itemInsert(person); } void BorrowerRegister::whenPersonInsertedFromMain(lib::Person person) { emit itemInsert(person); }
25.557895
70
0.679572
winthegame9
1f23c11bab6091dd70ae53585057c8dc71bbfb14
855
cpp
C++
scripting/lua/ScutControls/Win32/myWin32WebView.cpp
ScutGame/Client-source
7dd886bf128c857a957f5360fcc28bcd511bf654
[ "MIT" ]
23
2015-01-28T12:41:43.000Z
2021-07-14T05:35:56.000Z
scripting/lua/ScutControls/Win32/myWin32WebView.cpp
HongXiao/Client-source
7dd886bf128c857a957f5360fcc28bcd511bf654
[ "MIT" ]
null
null
null
scripting/lua/ScutControls/Win32/myWin32WebView.cpp
HongXiao/Client-source
7dd886bf128c857a957f5360fcc28bcd511bf654
[ "MIT" ]
35
2015-02-04T10:01:00.000Z
2021-03-05T15:27:14.000Z
#include "Win32WebView.h" #include "cocos2d.h" #include "myWin32WebView.h" namespace NdCxControl { void *Win32WebView(const char *pszUrl, cocos2d::CCRect rcScreenFrame, const char *pszTitle, const char *pszNormal, const char *pszPushDown) { CWin32WebView *pWebView = new CWin32WebView(); if(pWebView && pWebView->init(pszUrl, rcScreenFrame, pszTitle, pszNormal, pszPushDown)) { return pWebView; } else { if (pWebView) { delete pWebView; } return NULL; } } void CloseWin32WebView(void *pWebView) { if (pWebView) { CWin32WebView *pView = (CWin32WebView*)pWebView; pView->close(); } } void SwitchWin32WebViewUrl(void *pWebView, const char *pszUrl) { if (pWebView) { CWin32WebView *pView = (CWin32WebView*)pWebView; pView->switchUrl(pszUrl); } } }
20.357143
141
0.654971
ScutGame
1f263b9edbcfca1a85f53837cb55d2c013497e61
1,607
cpp
C++
Nacro/SDK/FN_SpeechBubbleWidget_functions.cpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
11
2021-08-08T23:25:10.000Z
2022-02-19T23:07:22.000Z
Nacro/SDK/FN_SpeechBubbleWidget_functions.cpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
1
2022-01-01T22:51:59.000Z
2022-01-08T16:14:15.000Z
Nacro/SDK/FN_SpeechBubbleWidget_functions.cpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
8
2021-08-09T13:51:54.000Z
2022-01-26T20:33:37.000Z
// Fortnite (1.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function SpeechBubbleWidget.SpeechBubbleWidget_C.InitFromObject // (Event, Public, BlueprintCallable, BlueprintEvent) // Parameters: // class UObject* InitObject (Parm, ZeroConstructor, IsPlainOldData) void USpeechBubbleWidget_C::InitFromObject(class UObject* InitObject) { static auto fn = UObject::FindObject<UFunction>("Function SpeechBubbleWidget.SpeechBubbleWidget_C.InitFromObject"); USpeechBubbleWidget_C_InitFromObject_Params params; params.InitObject = InitObject; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SpeechBubbleWidget.SpeechBubbleWidget_C.ExecuteUbergraph_SpeechBubbleWidget // (HasDefaults) // Parameters: // int EntryPoint (Parm, ZeroConstructor, IsPlainOldData) void USpeechBubbleWidget_C::ExecuteUbergraph_SpeechBubbleWidget(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function SpeechBubbleWidget.SpeechBubbleWidget_C.ExecuteUbergraph_SpeechBubbleWidget"); USpeechBubbleWidget_C_ExecuteUbergraph_SpeechBubbleWidget_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
26.783333
137
0.679527
Milxnor
1f2a00d5500b776e4c4e83265b682523580237c6
1,258
cpp
C++
EZOJ/Contests/1276/C.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
6
2019-09-30T16:11:00.000Z
2021-11-01T11:42:33.000Z
EZOJ/Contests/1276/C.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
4
2017-11-21T08:17:42.000Z
2020-07-28T12:09:52.000Z
EZOJ/Contests/1276/C.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
4
2017-07-26T05:54:06.000Z
2020-09-30T13:35:38.000Z
#include <iostream> #include <cstdio> #include <cstring> #include <cassert> #include <cmath> #include <vector> using namespace std; typedef long long lint; inline bool is_num(char c){ return c>='0'&&c<='9'; } inline int ni(){ int i=0;char c; while(!is_num(c=getchar())); while(i=i*10-'0'+c,is_num(c=getchar())); return i; } inline long long nl(){ long long i=0;char c; while(!is_num(c=getchar())); while(i=i*10-'0'+c,is_num(c=getchar())); return i; } const int K=65; const lint N=1000000000000000010ll; vector<lint>f[K]; inline lint solve2(lint n){ lint i=(sqrt(n*8+1)-1)/2; for(;i*(i+1)<n*2;i++); return i; } inline int solve(lint n,vector<lint>&f){ int l=0,r=f.size()-1,mid; while(l<r){ mid=(l+r)>>1; if(f[mid]<n){ l=mid+1; }else{ r=mid; } } return l; } int main(){ f[3].push_back(0); for(int i=1;f[3].back()<N;i++){ f[3].push_back(f[3][i-1]+(lint)i*(i-1)/2+1); } for(int i=4;i<K;i++){ f[i].push_back(0); for(int j=1;f[i].back()<N;j++){ f[i].push_back(f[i][j-1]+f[i-1][j-1]+1); } } lint n; int k; for(int tot=ni();tot--;){ n=nl(),k=ni(); if(n==0){ puts("0"); }else if(k==1){ printf("%lld\n",n); }else if(k==2){ printf("%lld\n",solve2(n)); }else{ printf("%d\n",solve(n,f[k])); } } }
17.971429
46
0.566773
sshockwave
1f2fa872325ae64e4492f854c686f00b07153594
2,734
cpp
C++
Nagi/Source/Input/Keyboard.cpp
nfginola/VkPlayground
b512117f47497d2c8f24b501e9fd3d8861504187
[ "MIT" ]
1
2022-01-09T05:30:29.000Z
2022-01-09T05:30:29.000Z
Nagi/Source/Input/Keyboard.cpp
nfginola/VkPlayground
b512117f47497d2c8f24b501e9fd3d8861504187
[ "MIT" ]
null
null
null
Nagi/Source/Input/Keyboard.cpp
nfginola/VkPlayground
b512117f47497d2c8f24b501e9fd3d8861504187
[ "MIT" ]
null
null
null
#include "pch.h" #include "Input/Keyboard.h" #include <GLFW/glfw3.h> namespace Nagi { Keyboard::Keyboard() { } void Keyboard::handleKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { // Perhaps we can add an intermediary between GLFW and Keyboard. // This way, only the intermediary knows about GLFW and Keyboard while Keyboard doesn't have to know about GLFW // but it will add complexity since we would have to maintain the intermediary in the case of added functionality // Save it for sometime later maybe if (key == GLFW_KEY_Q) handleKeyAction(KeyName::Q, action); if (key == GLFW_KEY_W) handleKeyAction(KeyName::W, action); if (key == GLFW_KEY_E) handleKeyAction(KeyName::E, action); if (key == GLFW_KEY_R) handleKeyAction(KeyName::R, action); if (key == GLFW_KEY_T) handleKeyAction(KeyName::T, action); if (key == GLFW_KEY_Y) handleKeyAction(KeyName::Y, action); if (key == GLFW_KEY_U) handleKeyAction(KeyName::U, action); if (key == GLFW_KEY_I) handleKeyAction(KeyName::I, action); if (key == GLFW_KEY_O) handleKeyAction(KeyName::O, action); if (key == GLFW_KEY_P) handleKeyAction(KeyName::P, action); if (key == GLFW_KEY_A) handleKeyAction(KeyName::A, action); if (key == GLFW_KEY_S) handleKeyAction(KeyName::S, action); if (key == GLFW_KEY_D) handleKeyAction(KeyName::D, action); if (key == GLFW_KEY_F) handleKeyAction(KeyName::F, action); if (key == GLFW_KEY_G) handleKeyAction(KeyName::G, action); if (key == GLFW_KEY_H) handleKeyAction(KeyName::H, action); if (key == GLFW_KEY_J) handleKeyAction(KeyName::J, action); if (key == GLFW_KEY_K) handleKeyAction(KeyName::K, action); if (key == GLFW_KEY_L) handleKeyAction(KeyName::L, action); if (key == GLFW_KEY_Z) handleKeyAction(KeyName::Z, action); if (key == GLFW_KEY_X) handleKeyAction(KeyName::X, action); if (key == GLFW_KEY_C) handleKeyAction(KeyName::C, action); if (key == GLFW_KEY_V) handleKeyAction(KeyName::V, action); if (key == GLFW_KEY_B) handleKeyAction(KeyName::B, action); if (key == GLFW_KEY_N) handleKeyAction(KeyName::N, action); if (key == GLFW_KEY_M) handleKeyAction(KeyName::M, action); if (key == GLFW_KEY_SPACE) handleKeyAction(KeyName::Space, action); if (key == GLFW_KEY_LEFT_SHIFT) handleKeyAction(KeyName::LShift, action); } bool Keyboard::isKeyDown(KeyName key) { return m_keyStates[key].isDown(); } bool Keyboard::isKeyPressed(KeyName key) { return m_keyStates[key].justPressed(); } void Keyboard::handleKeyAction(KeyName key, int action) { if (action == GLFW_PRESS) m_keyStates[key].onPress(); else if (action == GLFW_RELEASE) m_keyStates[key].onRelease(); } }
38.507042
115
0.70117
nfginola
1f31d6fd566d687bc8afbb8baca1657844ef5628
8,665
hpp
C++
src/area776.hpp
r6eve/area776
c39b9d2393a7cdaaa056933fa452ec9adfc8fdce
[ "BSL-1.0" ]
null
null
null
src/area776.hpp
r6eve/area776
c39b9d2393a7cdaaa056933fa452ec9adfc8fdce
[ "BSL-1.0" ]
1
2018-06-02T05:38:40.000Z
2018-06-02T07:47:41.000Z
src/area776.hpp
r6eve/area776
c39b9d2393a7cdaaa056933fa452ec9adfc8fdce
[ "BSL-1.0" ]
null
null
null
// // Copyright r6eve 2019 - // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // #pragma once #include <iomanip> #include <memory> #include <sstream> #include "boss.hpp" #include "def_global.hpp" #include "effect.hpp" #include "enemy.hpp" #include "fighter.hpp" #include "font_manager.hpp" #include "image_manager.hpp" #include "input_manager.hpp" #include "mixer_manager.hpp" #include "snow.hpp" #include "wipe.hpp" struct RGB { Uint8 r; Uint8 g; Uint8 b; }; namespace rgb { const RGB black = RGB{0x00, 0x00, 0x00}; const RGB red = RGB{0xff, 0x00, 0x00}; const RGB dark_red = RGB{0xb0, 0x00, 0x00}; const RGB green = RGB{0x00, 0xff, 0x00}; const RGB white = RGB{0xff, 0xff, 0xff}; } // namespace rgb class Area776 { enum class game_state { title, start, clear, playing, gameover, pause, }; const bool fullscreen_mode_; const bool debug_mode_; SDL_Window *window_; SDL_Renderer *renderer_; int blink_count_; int game_count_; game_state game_state_; int game_level_; enemy_type enemy_select_; std::unique_ptr<ImageManager> image_manager_; std::unique_ptr<InputManager> input_manager_; std::unique_ptr<MixerManager> mixer_manager_; std::unique_ptr<Fighter> fighter_; std::unique_ptr<Enemies> enemies_; std::unique_ptr<Boss> boss_; std::unique_ptr<Effects> effects_; std::unique_ptr<Wipe> wipe_; std::unique_ptr<Snow> snow_; FontManager font_manager_; void game_title() noexcept; void game_start() noexcept; void play_game() noexcept; void game_clear() noexcept; void game_over() noexcept; void game_pause() noexcept; inline void draw_text(const unsigned char font_size, const RGB &rgb, const Point &p, const char *str) const noexcept { const SDL_Color color = {rgb.r, rgb.g, rgb.b, 255}; SDL_Surface *font_surface = TTF_RenderUTF8_Blended(font_manager_.get(font_size), str, color); SDL_Texture *font_texture = SDL_CreateTextureFromSurface(renderer_, font_surface); const SDL_Rect src = {0, 0, static_cast<Uint16>(font_surface->w), static_cast<Uint16>(font_surface->h)}; SDL_Rect dst; dst.x = static_cast<Sint16>(p.x); dst.y = static_cast<Sint16>(p.y); SDL_QueryTexture(font_texture, nullptr, nullptr, &dst.w, &dst.h); SDL_RenderCopy(renderer_, font_texture, &src, &dst); SDL_DestroyTexture(font_texture); } inline void draw_text(const unsigned char font_size, const RGB &&rgb, const Point &p, const char *str) const noexcept { draw_text(font_size, rgb, p, str); } inline void draw_text(const unsigned char font_size, const RGB &rgb, const Point &&p, const char *str) const noexcept { draw_text(font_size, rgb, p, str); } inline void draw_text(const unsigned char font_size, const RGB &&rgb, const Point &&p, const char *str) const noexcept { draw_text(font_size, rgb, p, str); } inline void draw_life() noexcept { switch (enemy_select_) { case enemy_type::enemy: { std::stringstream ss; ss << "ENEMY LIFE: " << enemies_->get_life(); draw_text(font_size::x16, rgb::white, Point{32, 24}, ss.str().c_str()); break; } case enemy_type::boss: { std::stringstream ss; ss << "BOSS LIFE: " << boss_->get_life(); draw_text(font_size::x16, rgb::white, Point{32, 24}, ss.str().c_str()); break; } } std::stringstream ss; ss << "LIFE: " << fighter_->get_life(); draw_text(font_size::x16, rgb::white, fighter_->get_pos() + Point{0, 55}, ss.str().c_str()); } inline bool poll_event() noexcept { SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: return false; case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_ESCAPE) { return false; } break; default: // do nothing break; } } return true; } inline void wait_game() noexcept { static Uint32 pre_count; const double wait_time = 1000.0 / screen::max_fps; const Uint32 wait_count = (wait_time + 0.5); if (pre_count) { const Uint32 now_count = SDL_GetTicks(); const Uint32 interval = now_count - pre_count; if (interval < wait_count) { const Uint32 delay_time = wait_count - interval; SDL_Delay(delay_time); } } pre_count = SDL_GetTicks(); } inline void draw_fps() noexcept { static Uint32 pre_count; const Uint32 now_count = SDL_GetTicks(); if (pre_count) { static double frame_rate; Uint32 mut_interval = now_count - pre_count; if (mut_interval < 1) { mut_interval = 1; } const Uint32 interval = mut_interval; if (!(pre_count % 30)) { frame_rate = 1000.0 / interval; } std::stringstream ss; ss << "FrameRate[" << std::setprecision(2) << std::setiosflags(std::ios::fixed) << frame_rate << "]"; draw_text(font_size::x16, rgb::green, Point{screen::width - 140, 16}, ss.str().c_str()); } pre_count = now_count; } inline void draw_map() noexcept { SDL_Texture *map_texture = image_manager_->get(image::map); const SDL_Rect src = {0, 0, screen::width, screen::height}; const SDL_Rect dst = {0, 0, screen::width, screen::height}; SDL_RenderCopy(renderer_, map_texture, &src, &dst); SDL_DestroyTexture(map_texture); } inline void draw_translucence() noexcept { Uint32 rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; #else rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; #endif SDL_Surface *trans_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, screen::width, screen::height, 32, rmask, gmask, bmask, amask); if (trans_surface == nullptr) { std::cerr << "CreateRGBSurface failed: " << SDL_GetError() << '\n'; exit(EXIT_FAILURE); } SDL_Texture *trans_texture = SDL_CreateTextureFromSurface(renderer_, trans_surface); SDL_FreeSurface(trans_surface); const SDL_Rect src = {0, 0, screen::width, screen::height}; const SDL_Rect dst = {0, 0, screen::width, screen::height}; SDL_RenderCopy(renderer_, trans_texture, &src, &dst); SDL_DestroyTexture(trans_texture); if (blink_count_ < 30) { draw_text(font_size::x36, rgb::white, Point{220, 180}, "P a u s e"); ++blink_count_; } else if (blink_count_ < 60) { ++blink_count_; } else { blink_count_ = 0; } } public: Area776(const bool fullscreen_mode, const bool debug_mode) noexcept : fullscreen_mode_(fullscreen_mode), debug_mode_(debug_mode), blink_count_(0), game_count_(0), game_state_(game_state::title) { if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { std::cerr << "error: " << SDL_GetError() << '\n'; exit(EXIT_FAILURE); } Uint32 flags = SDL_WINDOW_SHOWN; if (fullscreen_mode_) { flags |= SDL_WINDOW_FULLSCREEN; } window_ = SDL_CreateWindow("Area776", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen::width, screen::height, flags); if (window_ == nullptr) { std::cerr << "error: " << SDL_GetError() << '\n'; exit(EXIT_FAILURE); } renderer_ = SDL_CreateRenderer(window_, -1, SDL_RENDERER_ACCELERATED); if (renderer_ == nullptr) { std::cerr << "error: " << SDL_GetError() << '\n'; exit(EXIT_FAILURE); } image_manager_ = std::make_unique<ImageManager>(renderer_); input_manager_ = std::make_unique<InputManager>(); mixer_manager_ = std::make_unique<MixerManager>(); fighter_ = std::make_unique<Fighter>( image_manager_.get(), input_manager_.get(), mixer_manager_.get()); enemies_ = std::make_unique<Enemies>(image_manager_.get(), mixer_manager_.get()); boss_ = std::make_unique<Boss>(image_manager_.get(), mixer_manager_.get()); effects_ = std::make_unique<Effects>(image_manager_.get()); wipe_ = std::make_unique<Wipe>(renderer_); snow_ = std::make_unique<Snow>(image_manager_.get()); SDL_ShowCursor(SDL_DISABLE); } void run() noexcept; ~Area776() noexcept { atexit(SDL_Quit); } };
30.403509
79
0.63416
r6eve
1f327aadd4b254c47bdf5dd03c2390ad82891df2
3,788
cpp
C++
src/common/EnumStringMapper.cpp
cgodkin/fesapi
d25c5e30ccec537c471adc3bb036c48f2c51f2c9
[ "Apache-2.0" ]
1
2021-01-04T16:19:33.000Z
2021-01-04T16:19:33.000Z
src/common/EnumStringMapper.cpp
philippeVerney/fesapi
5aff682d8e707d4682a0d8674b5f6353be24ed55
[ "Apache-2.0" ]
null
null
null
src/common/EnumStringMapper.cpp
philippeVerney/fesapi
5aff682d8e707d4682a0d8674b5f6353be24ed55
[ "Apache-2.0" ]
null
null
null
/*----------------------------------------------------------------------- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -----------------------------------------------------------------------*/ #include "EnumStringMapper.h" #include "../proxies/gsoap_resqml2_0_1H.h" #include "../proxies/gsoap_eml2_1H.h" using namespace COMMON_NS; EnumStringMapper::EnumStringMapper() { gsoapContext = soap_new2(SOAP_XML_STRICT | SOAP_C_UTFSTRING | SOAP_XML_IGNORENS, SOAP_XML_TREE | SOAP_XML_INDENT | SOAP_XML_CANONICAL | SOAP_C_UTFSTRING); } EnumStringMapper::~EnumStringMapper() { soap_destroy(gsoapContext); // remove deserialized C++ objects soap_end(gsoapContext); // remove deserialized data soap_done(gsoapContext); // finalize last use of the context soap_free(gsoapContext); // Free the context } std::string EnumStringMapper::getEnergisticsPropertyKindName(gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind energisticsPropertyKind) const { return gsoap_resqml2_0_1::soap_resqml20__ResqmlPropertyKind2s(gsoapContext, energisticsPropertyKind); } gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind EnumStringMapper::getEnergisticsPropertyKind(const std::string & energisticsPropertyKindName) const { gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind result; return gsoap_resqml2_0_1::soap_s2resqml20__ResqmlPropertyKind(gsoapContext, energisticsPropertyKindName.c_str(), &result) == SOAP_OK ? result : gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind__RESQML_x0020root_x0020property; } std::string EnumStringMapper::getEnergisticsUnitOfMeasureName(gsoap_resqml2_0_1::resqml20__ResqmlUom energisticsUom) const { return gsoap_resqml2_0_1::soap_resqml20__ResqmlUom2s(gsoapContext, energisticsUom); } gsoap_resqml2_0_1::resqml20__ResqmlUom EnumStringMapper::getEnergisticsUnitOfMeasure(const std::string & energisticsUomName) const { gsoap_resqml2_0_1::resqml20__ResqmlUom result; return gsoap_resqml2_0_1::soap_s2resqml20__ResqmlUom(gsoapContext, energisticsUomName.c_str(), &result) == SOAP_OK ? result : gsoap_resqml2_0_1::resqml20__ResqmlUom__Euc; } std::string EnumStringMapper::getFacet(gsoap_resqml2_0_1::resqml20__Facet facet) const { return gsoap_resqml2_0_1::soap_resqml20__Facet2s(gsoapContext, facet); } gsoap_resqml2_0_1::resqml20__Facet EnumStringMapper::getFacet(const std::string & facet) const { gsoap_resqml2_0_1::resqml20__Facet result; return gsoap_resqml2_0_1::soap_s2resqml20__Facet(gsoapContext, facet.c_str(), &result) == SOAP_OK ? result : gsoap_resqml2_0_1::resqml20__Facet__what; } std::string EnumStringMapper::lengthUomToString(gsoap_eml2_1::eml21__LengthUom witsmlUom) const { return gsoap_eml2_1::soap_eml21__LengthUom2s(gsoapContext, witsmlUom); } std::string EnumStringMapper::verticalCoordinateUomToString(gsoap_eml2_1::eml21__VerticalCoordinateUom witsmlUom) const { return gsoap_eml2_1::soap_eml21__VerticalCoordinateUom2s(gsoapContext, witsmlUom); } std::string EnumStringMapper::planeAngleUomToString(gsoap_eml2_1::eml21__PlaneAngleUom witsmlUom) const { return gsoap_eml2_1::soap_eml21__PlaneAngleUom2s(gsoapContext, witsmlUom); }
44.046512
225
0.802798
cgodkin
1f38f894c5c4f23f8b23ee8e6d6ca7870503bc6e
2,543
cpp
C++
openbr/plugins/imgproc/gradient.cpp
gaatyin/openbr
a55fa7bd0038b323ade2340c69f109146f084218
[ "Apache-2.0" ]
1
2021-04-26T12:53:42.000Z
2021-04-26T12:53:42.000Z
openbr/plugins/imgproc/gradient.cpp
William-New/openbr
326f9bbb84de35586e57b1b0449c220726571c6c
[ "Apache-2.0" ]
null
null
null
openbr/plugins/imgproc/gradient.cpp
William-New/openbr
326f9bbb84de35586e57b1b0449c220726571c6c
[ "Apache-2.0" ]
null
null
null
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright 2012 The MITRE Corporation * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <opencv2/imgproc/imgproc.hpp> #include <openbr/plugins/openbr_internal.h> using namespace cv; namespace br { /*! * \ingroup transforms * \brief Computes magnitude and/or angle of image. * \author Josh Klontz \cite jklontz */ class GradientTransform : public UntrainableTransform { Q_OBJECT Q_ENUMS(Channel) Q_PROPERTY(Channel channel READ get_channel WRITE set_channel RESET reset_channel STORED false) public: enum Channel { Magnitude, Angle, MagnitudeAndAngle }; private: BR_PROPERTY(Channel, channel, Angle) void project(const Template &src, Template &dst) const { Mat dx, dy, magnitude, angle; Sobel(src, dx, CV_32F, 1, 0, FILTER_SCHARR); Sobel(src, dy, CV_32F, 0, 1, FILTER_SCHARR); cartToPolar(dx, dy, magnitude, angle, true); std::vector<Mat> mv; if ((channel == Magnitude) || (channel == MagnitudeAndAngle)) { const float theoreticalMaxMagnitude = sqrt(2*pow(float(2*(3+10+3)*255), 2.f)); mv.push_back(magnitude / theoreticalMaxMagnitude); } if ((channel == Angle) || (channel == MagnitudeAndAngle)) mv.push_back(angle); Mat result; merge(mv, result); dst.append(result); } }; BR_REGISTER(Transform, GradientTransform) } // namespace br #include "imgproc/gradient.moc"
37.955224
99
0.527723
gaatyin
1f3c3aaebd967b19bd4b6bc76baf6de9c5647988
6,846
cpp
C++
sim/config.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
7
2016-03-01T13:16:59.000Z
2021-08-20T07:41:43.000Z
sim/config.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
null
null
null
sim/config.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
5
2015-04-20T14:29:38.000Z
2018-12-29T11:09:17.000Z
#include "sim/config.h" #include "programs/mgsim.h" #include <set> #include <map> #include <vector> using namespace std; void Config::collectPropertiesByType(Config::types_t& types, Config::typeattrs_t& typeattrs) { map<Symbol, set<Symbol> > collect; for (auto& i : m_objects) { types[m_objects[i.first]].clear(); typeattrs[m_objects[i.first]].clear(); } for (auto& i : m_objprops) { for (auto& j : i.second) collect[m_objects[i.first]].insert(j.first); } for (auto& i : collect) { size_t j = 0; for (auto k : i.second) { types[i.first].push_back(k); typeattrs[i.first][k] = j++; } } } vector<uint32_t> Config::GetConfWords() { types_t types; typeattrs_t typeattrs; collectPropertiesByType(types, typeattrs); vector<uint32_t> db; map<Symbol, vector<size_t> > attrtable_backrefs; map<Symbol, vector<size_t> > sym_backrefs; map<ObjectRef, vector<size_t> > obj_backrefs; map<Symbol, size_t> type_table; map<Symbol, size_t> attrtable_table; map<ObjectRef, size_t> obj_table; map<Symbol, size_t> sym_table; size_t cur_next_offset; db.push_back(CONF_MAGIC); // types: number of types, then type entries // format for each type entry: // word 0: global offset to symbol // word 1: global offset to attribute table // HEADER db.push_back(CONF_TAG_TYPETABLE); cur_next_offset = db.size(); db.push_back(0); // CONTENT - HEADER db.push_back(types.size()); // ENTRIES size_t typecnt = 0; for (auto& i : types) { sym_backrefs[i.first].push_back(db.size()); db.push_back(0); if (!i.second.empty()) attrtable_backrefs[i.first].push_back(db.size()); db.push_back(0); type_table[i.first] = typecnt++; } db[cur_next_offset] = db.size(); // attribute tables. For each table: // word 0: number of entries, // word 1: logical offset to object type in type table // then entries. Each entry is a global symbol offset (1 word) for (auto& i : types) { if (i.second.empty()) continue; // HEADER db.push_back(CONF_TAG_ATTRTABLE); cur_next_offset = db.size(); db.push_back(0); // CONTENT - HEADER attrtable_table[i.first] = db.size(); db.push_back(i.second.size()); db.push_back(type_table[i.first]); // ENTRIES for (auto j : i.second) { sym_backrefs[j].push_back(db.size()); db.push_back(0); } db[cur_next_offset] = db.size(); } // objects. For each object: // word 0: logical offset to object type in type table // then properties. Each property is a pair (entity type, global offset/value) // each property's position matches the attribute name offsets // in the type-attribute table. // for (auto& i : m_objects) { // HEADER db.push_back(CONF_TAG_OBJECT); cur_next_offset = db.size(); db.push_back(0); // CONTENT - HEADER obj_table[i.first] = db.size(); db.push_back(type_table[i.second]); // ENTRIES // collect the attributes actually defined in the // order defined by the type auto& propdescs = typeattrs.find(i.second)->second; vector<EntityRef> collect; collect.resize(propdescs.size(), 0); auto op = m_objprops.find(i.first); if (op != m_objprops.end()) { auto& props = op->second; for (auto& j : props) { collect[propdescs.find(j.first)->second] = j.second; } } // populate according to logical attribute order defined by type for (auto j : collect) { if (j != 0) { const Entity& e = *j; db.push_back(e.type); size_t cur_offset = db.size(); switch(e.type) { case Entity::VOID: db.push_back(0); break; case Entity::SYMBOL: sym_backrefs[e.symbol].push_back(cur_offset); db.push_back(0); break; case Entity::OBJECT: obj_backrefs[e.object].push_back(cur_offset); db.push_back(0); break; case Entity::UINT: db.push_back(e.value); break; } } else { db.push_back(0); db.push_back(0); } } db[cur_next_offset] = db.size(); } // raw configuration table. // word 0: number of entries. // then entries. Each entry is a pair (symbol, symbol) auto rawconf = getRawConfiguration(); // HEADER db.push_back(CONF_TAG_RAWCONFIG); cur_next_offset = db.size(); db.push_back(0); // CONTENT - HEADER db.push_back(rawconf.size()); // ENTRIES for (auto& i : rawconf) { Symbol key = makeSymbol(i.first); Symbol val = makeSymbol(i.second); sym_backrefs[key].push_back(db.size()); db.push_back(0); sym_backrefs[val].push_back(db.size()); db.push_back(0); } db[cur_next_offset] = db.size(); // symbols. For each symbol: // word 0: size (number of characters) // then characters, nul-terminated for (auto& i : m_symbols) { // HEADER db.push_back(CONF_TAG_SYMBOL); cur_next_offset = db.size(); db.push_back(0); // CONTENT - HEADER sym_table[&i] = db.size(); db.push_back(i.size()); // ENTRIES - CHARACTERS size_t first_pos = db.size(); // we want to enforce byte order, so we cannot use memcpy // because the host might be big endian. vector<char> raw(i.begin(), i.end()); raw.resize(((raw.size() / sizeof(uint32_t)) + 1) * sizeof(uint32_t), 0); db.resize(db.size() + raw.size() / sizeof(uint32_t)); for (size_t j = first_pos, k = 0; j < db.size(); ++j, k += 4) { uint32_t val = (uint32_t)raw[k] | ((uint32_t)raw[k+1] << 8) | ((uint32_t)raw[k+2] << 16) | ((uint32_t)raw[k+3] << 24); db[j] = val; } db[cur_next_offset] = db.size(); } // terminate the chain with a nul tag db.push_back(0); // now resolve all back references for (auto& i : attrtable_backrefs) for (auto j : i.second) db[j] = attrtable_table[i.first]; for (auto& i : sym_backrefs) for (auto j : i.second) db[j] = sym_table[i.first]; for (auto& i : obj_backrefs) for (auto j : i.second) db[j] = obj_table[i.first]; return db; }
27.384
106
0.551417
svp-dev
1f3f71f2c7fb4c372c14046673ea851a9d6fb79f
355
hpp
C++
include/rect.hpp
teamprova/ProvaEngine-CPP
0ba9b4b0d73a5a261194d5333e5a572c40c0c21f
[ "Unlicense" ]
null
null
null
include/rect.hpp
teamprova/ProvaEngine-CPP
0ba9b4b0d73a5a261194d5333e5a572c40c0c21f
[ "Unlicense" ]
null
null
null
include/rect.hpp
teamprova/ProvaEngine-CPP
0ba9b4b0d73a5a261194d5333e5a572c40c0c21f
[ "Unlicense" ]
null
null
null
#pragma once namespace Prova { class Vector2; class Rect { public: Rect(); Rect(float left, float top, float width, float height); float left; float top; float width; float height; Vector2 GetTopLeft(); Vector2 GetTopRight(); Vector2 GetBottomLeft(); Vector2 GetBottomRight(); }; }
16.904762
61
0.594366
teamprova
1f40b744c830dbb7b3165bde25fdc7f0091c7e02
1,221
cpp
C++
workshop5-6/Sum.cpp
PavanKamra96/BTP200
516f5ed60452da53d47206caef22423825a3145e
[ "MIT" ]
null
null
null
workshop5-6/Sum.cpp
PavanKamra96/BTP200
516f5ed60452da53d47206caef22423825a3145e
[ "MIT" ]
null
null
null
workshop5-6/Sum.cpp
PavanKamra96/BTP200
516f5ed60452da53d47206caef22423825a3145e
[ "MIT" ]
null
null
null
/** Name: Pavan Kumar Kamra Course: BTP200 **/ #include <iostream> #include <cstring> #include "Sum.h" using namespace std; // constructor with defaults Sum::Sum() { array = nullptr; size = 0; counter = 0; sum = 0; } // recieves the size of the array Sum::Sum(int s) { if (s > 0) size = s; else size = 0; array = new int[size]; counter = 0; sum = 0; } // recieves an array of numbers + size Sum::Sum(const int * tArray, int o) { if (o > 0) { array = new int[o]; size = o; sum = 0; counter = 0; for (int i = 0; i < size; i++) { array[i] = tArray[i]; } for (int k = 0; k < size; k++) { sum = array[k] + sum; } } else size = 0; } // displays the results void Sum::display() const { int j = 0; while (j < size - 1) { cout << array[j] << "+"; j++; } cout << array[size - 1] << "=" << sum << endl; } // mem operator that adds a num to current obj and returns ref to the current obj Sum & Sum::operator += (int n) { if (counter < size) { array[counter] = n; sum = sum + n; counter = counter + 1; } else { cerr << "No room for anymore numbers " << n << " has not been added" << endl; } return *this; }
18.223881
81
0.530713
PavanKamra96
1f4236929b5440ffed877c85b19e07125f382c81
4,329
cpp
C++
Ouroboros/Source/oString/codify_data.cpp
jiangzhu1212/oooii
fc00ff81e74adaafd9c98ba7c055f55d95a36e3b
[ "MIT" ]
null
null
null
Ouroboros/Source/oString/codify_data.cpp
jiangzhu1212/oooii
fc00ff81e74adaafd9c98ba7c055f55d95a36e3b
[ "MIT" ]
null
null
null
Ouroboros/Source/oString/codify_data.cpp
jiangzhu1212/oooii
fc00ff81e74adaafd9c98ba7c055f55d95a36e3b
[ "MIT" ]
null
null
null
// Copyright (c) 2014 Antony Arciuolo. See License.txt regarding use. #include <oString/string.h> #include <iterator> int snprintf(char* dst, size_t dst_size, const char* fmt, ...); using namespace std; namespace ouro { errno_t replace(char* oRESTRICT result, size_t result_size, const char* oRESTRICT src, const char* find, const char* replace); template<typename T> struct StaticArrayTraits {}; template<> struct StaticArrayTraits<unsigned char> { static const size_t WORDS_PER_LINE = 20; static inline const char* GetFormat() { return "0x%02x,"; } static inline const char* GetType() { return "unsigned char"; } }; template<> struct StaticArrayTraits<unsigned short> { static const size_t WORDS_PER_LINE = 16; static inline const char* GetFormat() { return "0x%04x,"; } static inline const char* GetType() { return "unsigned short"; } }; template<> struct StaticArrayTraits<unsigned int> { static const size_t WORDS_PER_LINE = 10; static inline const char* GetFormat() { return "0x%08x,"; } static inline const char* GetType() { return "unsigned int"; } }; template<> struct StaticArrayTraits<uint64_t> { static const size_t WORDS_PER_LINE = 10; static inline const char* GetFormat() { return "0x%016llx,"; } static inline const char* GetType() { return "uint64_t"; } }; static const char* file_base(const char* path) { const char* p = path + strlen(path) - 1; while (p >= path) { if (*p == '/' || *p == '\\') return p + 1; p--; } return nullptr; } static char* codify_buffer_name(char* dst, size_t dst_size, const char* path) { if (replace(dst, dst_size, file_base(path), ".", "_")) return nullptr; return dst; } template<size_t size> inline char* codify_buffer_name(char (&dst)[size], const char* path) { return codify_buffer_name(dst, size, path); } template<typename T> static size_t codify_data(char* dst, size_t dst_size, const char* buffer_name, const T* buf, size_t buf_size) { const T* words = static_cast<const T*>(buf); char* str = dst; char* end = str + dst_size - 1; // -1 for terminator const size_t nWords = buf_size / sizeof(T); str += snprintf(str, dst_size, "const %s sBuffer[] = \n{ // *** AUTO-GENERATED BUFFER, DO NOT EDIT ***", StaticArrayTraits<T>::GetType()); for (size_t i = 0; i < nWords; i++) { size_t numberOfElementsLeft = std::distance(str, end); if ((i % StaticArrayTraits<T>::WORDS_PER_LINE) == 0 && numberOfElementsLeft > 2) { *str++ = '\n'; *str++ = '\t'; numberOfElementsLeft -= 2; } str += snprintf(str, numberOfElementsLeft, StaticArrayTraits<T>::GetFormat(), *words++); } // handle any remaining bytes const size_t nExtraBytes = buf_size % sizeof(T); if (nExtraBytes) { uint64_t tmp = 0; memcpy(&tmp, &reinterpret_cast<const unsigned char*>(buf)[sizeof(T) * nWords], nExtraBytes); str += snprintf(str, std::distance(str, end), StaticArrayTraits<T>::GetFormat(), static_cast<T>(tmp)); } str += snprintf(str, std::distance(str, end), "\n};\n"); // add accessor function char bufferId[_MAX_PATH]; codify_buffer_name(bufferId, buffer_name); uint64_t sz = buf_size; // explicitly size this out so printf formatting below can remain the same between 32- and 64-bit str += snprintf(str, std::distance(str, end), "void get_%s(const char** ppBufferName, const void** ppBuffer, size_t* pSize) { *ppBufferName = \"%s\"; *ppBuffer = sBuffer; *pSize = %llu; }\n", bufferId, file_base(buffer_name), sz); if (str < end) *str++ = 0; return std::distance(dst, str); } size_t codify_data(char* oRESTRICT dst, size_t dst_size, const char* oRESTRICT buffer_name, const void* oRESTRICT buf, size_t buf_size, size_t word_size) { switch (word_size) { case sizeof(unsigned char): return codify_data(dst, dst_size, buffer_name, static_cast<const unsigned char*>(buf), buf_size); case sizeof(unsigned short): return codify_data(dst, dst_size, buffer_name, static_cast<const unsigned short*>(buf), buf_size); case sizeof(unsigned int): return codify_data(dst, dst_size, buffer_name, static_cast<const unsigned int*>(buf), buf_size); case sizeof(uint64_t): return codify_data(dst, dst_size, buffer_name, static_cast<const uint64_t*>(buf), buf_size); default: break; } return 0; } }
35.195122
232
0.68353
jiangzhu1212
1f436e92f7674bd40f703105967be8cc1a00b10e
3,438
cpp
C++
Engine/WindowManager.cpp
tairoman/CraftClone
b50e40f5fb4a10febe8a17a37a439aa238d8deb3
[ "MIT" ]
5
2018-11-17T18:15:44.000Z
2020-04-26T11:27:16.000Z
Engine/WindowManager.cpp
tairoman/CraftClone
b50e40f5fb4a10febe8a17a37a439aa238d8deb3
[ "MIT" ]
1
2020-04-22T13:03:52.000Z
2020-04-23T12:57:40.000Z
Engine/WindowManager.cpp
tairoman/CraftClone
b50e40f5fb4a10febe8a17a37a439aa238d8deb3
[ "MIT" ]
null
null
null
#include <SDL2/SDL_video.h> #include <cstdint> #include <iostream> #include "WindowManager.h" #include <GL/glew.h> #include <SDL2/SDL.h> #include <SDL2/SDL_opengl.h> #include <GL/glu.h> namespace { using namespace Engine; std::uint32_t windowModeToSDL(WindowMode mode) { switch (mode) { case WindowMode::Windowed: return 0; case WindowMode::Fullscreen: return SDL_WINDOW_FULLSCREEN; case WindowMode::WindowedFullscreen: return SDL_WINDOW_FULLSCREEN_DESKTOP; } } } namespace Engine { WindowManager::WindowManager() { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << ".\n"; exit(0); } SDL_GL_LoadLibrary(nullptr); SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); m_window.reset(SDL_CreateWindow( "", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED)); if (m_window == nullptr) { std::cerr << "Couldn't set video mode: " << SDL_GetError() << ".\n"; exit(0); } SDL_SetRelativeMouseMode(SDL_TRUE); // Create OpenGL context m_context = SDL_GL_CreateContext(m_window.get()); if (m_context == nullptr) { std::cerr << "Failed to create OpenGL context: " << SDL_GetError() << ".\n"; exit(0); } SDL_GL_MakeCurrent(m_window.get(), m_context); glewExperimental = GL_TRUE; const auto init_res = glewInit(); if(init_res != GLEW_OK) { std::cerr << "Failed to initialize GLEW!\n"; std::cerr << glewGetErrorString(glewInit()) << "\n"; exit(1); } if (SDL_GetDesktopDisplayMode(0, &m_currentDisplayMode) != 0) { std::cerr << SDL_GetError() << "\n"; exit(0); } setSize(m_currentDisplayMode.w, m_currentDisplayMode.h); setVSync(false); } void WindowManager::setSize(int w, int h) { m_width = w; m_height = h; if (m_windowMode == WindowMode::Fullscreen) { m_currentDisplayMode.w = m_width; m_currentDisplayMode.h = m_height; SDL_SetWindowDisplayMode(m_window.get(), &m_currentDisplayMode); } else { SDL_SetWindowSize(m_window.get(), m_width, m_height); } SDL_WarpMouseInWindow(m_window.get(), m_width / 2, m_height / 2); glViewport(0, 0, m_width, m_height); // Set viewport std::cout << "New width: " << m_width << "\n"; std::cout << "New height: " << m_height << "\n"; } void WindowManager::setWindowMode(WindowMode mode) { m_windowMode = mode; SDL_SetWindowFullscreen(m_window.get(), windowModeToSDL(mode)); if (mode == WindowMode::Fullscreen) { setSize(m_width, m_height); } } SDL_Window* WindowManager::sdlWindow() const { return m_window.get(); } int WindowManager::width() const { return m_width; } int WindowManager::height() const { return m_height; } void WindowManager::setVSync(bool setEnabled) { SDL_GL_SetSwapInterval(static_cast<int>(setEnabled)); } }
23.547945
84
0.656486
tairoman
1f4567327732139e8ac9da14afab1935c571db55
1,242
cc
C++
src/posix-pid.cc
afett/clingeling
e6f6810dde5a1076e70f261ef738ae8f4dbd4e54
[ "BSD-2-Clause" ]
null
null
null
src/posix-pid.cc
afett/clingeling
e6f6810dde5a1076e70f261ef738ae8f4dbd4e54
[ "BSD-2-Clause" ]
null
null
null
src/posix-pid.cc
afett/clingeling
e6f6810dde5a1076e70f261ef738ae8f4dbd4e54
[ "BSD-2-Clause" ]
null
null
null
/* Copyright (c) 2021 Andreas Fett. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ #include "posix/pid.h" #include "posix/signal.h" #include "posix/system-error.h" #include "posix/wait.h" #include <signal.h> #include <sys/wait.h> namespace Posix { class PidImpl : public Pid { public: explicit PidImpl(int value) : value_{value} { static_assert(std::is_same_v<pid_t, int>); } void kill(Signal) override; Wait::Status wait(Wait::Option) override; private: pid_t value_ = -1; }; std::shared_ptr<Pid> Pid::create(int value) { return std::make_shared<PidImpl>(value); } void PidImpl::kill(Signal sig) { auto res = ::kill(value_, static_cast<int>(sig)); if (res == -1) { throw make_system_error(errno, "::kill(%s, %s)", value_, static_cast<int>(sig)); } } namespace { int waitpid_opts(Wait::Option opt) { return opt == Wait::Option::NoHang ? WNOHANG : 0; } } Wait::Status PidImpl::wait(Wait::Option opt) { int status{0}; auto res = ::waitpid(value_, &status, waitpid_opts(opt)); if (res == -1) { throw make_system_error(errno, "::waitpid(%s, %x, %s)", value_, &status, waitpid_opts(opt)); } return Wait::Status{status}; } }
18.537313
94
0.673913
afett
1f4b21f86baa27718b6ea5a3cbf0c166bf2fdbc5
7,634
cpp
C++
src/configuration/RunConfig.cpp
Childcity/copyright_notice
3f343d42bc47a1d48a945ceb214ca9aa5da7ed69
[ "MIT" ]
null
null
null
src/configuration/RunConfig.cpp
Childcity/copyright_notice
3f343d42bc47a1d48a945ceb214ca9aa5da7ed69
[ "MIT" ]
null
null
null
src/configuration/RunConfig.cpp
Childcity/copyright_notice
3f343d42bc47a1d48a945ceb214ca9aa5da7ed69
[ "MIT" ]
null
null
null
#include "RunConfig.h" #include <mutex> #include <QCommandLineParser> #include <QDir> #include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> #include "src/file_utils/file_utils.h" #include "src/logger/log.h" #include "StaticConfig.h" namespace environment { void init() { qputenv("QT_ENABLE_REGEXP_JIT", "1"); } bool copyrightUpdateNotAllowed() { static constexpr const char *falseValues[]{"False", "false", "F", "f", "0"}; const auto enabled = qgetenv("LINT_ENABLE_COPYRIGHT_UPDATE"); return std::any_of(std::cbegin(falseValues), std::cend(falseValues), [&enabled](const auto &fv) { return enabled == fv; }); } } // namespace environment namespace { using Msg = logger::MsgCode; // clang-format off QCommandLineOption componentName{"component", "Add or replace software component mention.", "name"}; QCommandLineOption updateCopyright{"update-copyright", "Add or update copyright field (Year, Company, etc...)."}; QCommandLineOption updateFileName{"update-filename", "Add or fix 'File' field."}; QCommandLineOption updateAuthors{"update-authors", "Add or update author list."}; QCommandLineOption updateAuthorsOnlyIfEmpty{ "update-authors-only-if-empty", "Update author list only if this list is empty in author field (edited by someone else)."}; QCommandLineOption maxBlameAuthors{ "max-blame-authors-to-start-update", "Update author list only if blame authors <= some limit. " "Should be a positive number (0 or -1 mean 'unlimited' and used by default).", "number", "0"}; QCommandLineOption dontSkipBrokenMerges{ "dont-skip-broken-merges", "Do not skip broken merge commits."}; QCommandLineOption staticConfigPath{ "static-config", "Json configuration file with static configuration.", "path"}; QCommandLineOption dry{"dry", "Do not modify files, print to stdout instead."}; QCommandLineOption verbose{"verbose", "Print verbose output."}; // clang-format on void addOptions(QCommandLineParser &parser) { parser.setApplicationDescription(appconst::cAppDescription); parser.addHelpOption(); parser.addVersionOption(); // clang-format off parser.addOptions({ componentName , updateCopyright , updateFileName , updateAuthors , updateAuthorsOnlyIfEmpty , maxBlameAuthors , dontSkipBrokenMerges , staticConfigPath , dry , verbose }); // clang-format on parser.addPositionalArgument("file_or_dir", "File or directory to process.", "[paths...]"); } } // namespace RunConfig::RunConfig(const QStringList &arguments) noexcept { QCommandLineParser parser; addOptions(parser); parser.process(arguments); if (parser.isSet(verbose)) { m_runOptions |= RunOption::Verbose; } if (parser.isSet(::componentName)) { m_runOptions |= RunOption::UpdateComponent; m_componentName = parser.value(::componentName); if (m_componentName.isEmpty()) { CN_WARN(Msg::BadComponentName, "Component name is empty, that is why this field will be deleted."); } } if (parser.isSet(updateCopyright)) { m_runOptions |= RunOption::UpdateCopyright; } if (parser.isSet(updateFileName)) { m_runOptions |= RunOption::UpdateFileName; } if (parser.isSet(updateAuthors) && qgetenv("LINT_ENABLE_COPYRIGHT_UPDATE") == "") { m_runOptions |= RunOption::UpdateAuthors; } if (parser.isSet(updateAuthorsOnlyIfEmpty)) { m_runOptions |= RunOption::UpdateAuthorsOnlyIfEmpty; } if (parser.isSet(::maxBlameAuthors)) { bool isOk{}; m_maxBlameAuthors = parser.value(::maxBlameAuthors).toInt(&isOk); if (!isOk) { CN_ERR(Msg::BadMaxBlameAuthors, ::maxBlameAuthors.names().first() << " should be a positive number (0 or -1 " "mean 'unlimited' and used by default)."); parser.showHelp(apperror::RunArgError); } constexpr auto maxInt = std::numeric_limits<int>::max(); m_maxBlameAuthors = m_maxBlameAuthors > 0 ? m_maxBlameAuthors : maxInt; } if (parser.isSet(dontSkipBrokenMerges)) { m_runOptions |= RunOption::DontSkipBrokenMerges; } if (parser.isSet(::staticConfigPath)) { m_staticConfigPath = parser.value(::staticConfigPath); if (m_staticConfigPath.isEmpty()) { CN_ERR(Msg::BadStaticConfigPaths, ::staticConfigPath.names().first() << " should not be empty string."); parser.showHelp(apperror::RunArgError); } } else { QDir appDir(qApp->applicationDirPath()); m_staticConfigPath = appDir.canonicalPath() + QDir::separator() + appconst::cStaticConfig; } m_staticConfigPath = QDir::cleanPath(m_staticConfigPath); if (m_runOptions & RunOption::Verbose) { CN_DEBUG("Using static-config path " << m_staticConfigPath); } if (parser.isSet(dry) || environment::copyrightUpdateNotAllowed()) { m_runOptions |= RunOption::ReadOnlyMode; } m_targetPaths = parser.positionalArguments(); if (m_targetPaths.isEmpty() || m_targetPaths.first().isEmpty()) { CN_ERR(Msg::BadTargetPaths, "'file_or_dir' should not be empty string."); parser.showHelp(apperror::RunArgError); } std::transform(m_targetPaths.cbegin(), m_targetPaths.cend(), m_targetPaths.begin(), [](const auto &path) { return QDir::cleanPath(path); }); } namespace impl { StaticConfig getStaticConfig(const QString &path) { using namespace appconst::json; const auto handleError = [&path](const auto &action) { CN_ERR(Msg::BadStaticConfigFormat, QString("Error parsing static config '%1': %2").arg(path, action)); std::exit(apperror::RunArgError); }; const auto content = file_utils::readFile(path); const auto doc = QJsonDocument::fromJson(content); const auto root = doc.object(); if (root.isEmpty()) { handleError("root object is empty"); return {}; } const auto aliasesVal = root.value(cAuthorAliases); if (!root.contains(cAuthorAliases) || !aliasesVal.isObject()) { handleError(QString("map '%1' not found").arg(cAuthorAliases)); return {}; } AuthorAliasesMap authorAliases; const auto aliasesVariantHash = aliasesVal.toObject().toVariantHash(); std::for_each(aliasesVariantHash.constKeyValueBegin(), aliasesVariantHash.constKeyValueEnd(), [&authorAliases](const auto &keyValue) { authorAliases[keyValue.first] = keyValue.second.toString(); }); const auto copyrightFieldTemplateVal = root.value(cCopyrightFieldTemplate); if (!root.contains(cCopyrightFieldTemplate) || !copyrightFieldTemplateVal.isString()) { handleError(QString("string '%1' not found").arg(cCopyrightFieldTemplate)); return {}; } const auto excludedPathSectionsVal = root.value(cExcludedPathSections); if (!root.contains(cExcludedPathSections) || !excludedPathSectionsVal.isArray()) { handleError(QString("array '%1' not found").arg(cExcludedPathSections)); return {}; } ExcludedPathSections excludedPathSections; const auto excludedPathSectionsArr = excludedPathSectionsVal.toArray(); std::transform(excludedPathSectionsArr.cbegin(), excludedPathSectionsArr.cend(), std::back_inserter(excludedPathSections), [](const auto &value) { return value.toString(); }); // clang-format off return { std::move(authorAliases), copyrightFieldTemplateVal.toString(), std::move(excludedPathSections) }; // clang-format on } static std::unique_ptr<StaticConfig> gStaticConfigInstance; static std::once_flag create; } // namespace impl const StaticConfig &RunConfig::getStaticConfig(const QString &path) { std::call_once(impl::create, [=] { impl::gStaticConfigInstance = std::make_unique<StaticConfig>(impl::getStaticConfig(path)); }); return *::impl::gStaticConfigInstance; }
31.415638
113
0.716269
Childcity
1f4dc3123b91d623e648da04e7f74492d58ee1aa
1,092
cpp
C++
Engine/Base/GameTime.cpp
Antd23rus/S2DE_DirectX11
4f729278e6c795f7d606afc70a292c6501b0cafd
[ "MIT" ]
null
null
null
Engine/Base/GameTime.cpp
Antd23rus/S2DE_DirectX11
4f729278e6c795f7d606afc70a292c6501b0cafd
[ "MIT" ]
4
2021-10-21T12:42:04.000Z
2022-02-03T08:41:31.000Z
Engine/Base/GameTime.cpp
Antd23rus/S2DE
47cc7151c2934cd8f0399a9856c1e54894571553
[ "MIT" ]
1
2021-09-06T08:30:20.000Z
2021-09-06T08:30:20.000Z
#include "GameTime.h" #include "Base/Utils/Logger.h" namespace S2DE::Core { GameTime::GameTime() : m_time(std::chrono::high_resolution_clock::now()), m_time_begin(std::chrono::high_resolution_clock::now()), m_fps(0), m_frame_count(0), m_deltaTime(0.0f), m_timer(0.0f) { } GameTime::~GameTime() { } void GameTime::Tick() { m_frame_count++; m_time = std::chrono::high_resolution_clock::now(); m_deltaTime = std::chrono::duration_cast<std::chrono::microseconds>(m_time - m_time_lastUpdate).count() / 1000000.0f; m_timer_duration = m_time - m_time_begin; m_timer_duration = std::chrono::duration_cast<std::chrono::microseconds>(m_timer_duration); m_timer += m_timer_duration.count() / 10; if (m_time - m_time_begin >= std::chrono::seconds{ 1 }) { m_fps = m_frame_count; m_time_begin = m_time; m_frame_count = 0; } m_time_lastUpdate = m_time; } float GameTime::GetTime() const { return m_timer; } float GameTime::GetDeltaTime() const { return m_deltaTime; } std::int32_t GameTime::GetFPS() const { return m_fps; } }
18.2
119
0.685897
Antd23rus
1f524ece0c720ba2b1f74b40b87a0ac8f7a9a08a
4,768
cpp
C++
drivers/adagfx/lvdrv-adagfx-ssd1306.cpp
yhfudev/lv_platformio
45c9c2b1cdb14dac07fe59dc2993d6e33f07bc1d
[ "MIT" ]
null
null
null
drivers/adagfx/lvdrv-adagfx-ssd1306.cpp
yhfudev/lv_platformio
45c9c2b1cdb14dac07fe59dc2993d6e33f07bc1d
[ "MIT" ]
null
null
null
drivers/adagfx/lvdrv-adagfx-ssd1306.cpp
yhfudev/lv_platformio
45c9c2b1cdb14dac07fe59dc2993d6e33f07bc1d
[ "MIT" ]
null
null
null
/** * \file lvdrv-adagfx-ssd1306.cpp * \brief SSD1306 driver for LittlevGL * \author Yunhui Fu ([email protected]) * \version 1.0 * \date 2020-02-03 * \copyright GPL/BSD */ #include "lvgl.h" #include "lvdrv-adagfx-ssd1306.h" #include "setuprotary.h" #include "lvdrv-rotarygrp.h" //////////////////////////////////////////////////////////////////////////////// #include <Wire.h> #include "Adafruit_GFX.h" #include "Adafruit_SSD1306.h" // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 //4 // Reset pin # (or -1 if sharing Arduino reset pin) #if defined(ARDUINO_ARCH_ESP32) #define USE_ESP32_HELTEC_LORA2 1 #endif #if defined(USE_ESP32_HELTEC_LORA2) #define I2C_SDA 4 // heltec WIFI LoRa 32(V2) #define I2C_SCL 15 // heltec WIFI LoRa 32(V2) TwoWire twi = TwoWire(1); void init_heltec_lora2() { #if 0 pinMode(16, OUTPUT); digitalWrite(16, LOW); // set GPIO16 low to reset OLED delay(50); digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 to high #else #undef OLED_RESET #define OLED_RESET 16 #endif twi.begin(I2C_SDA, I2C_SCL); } #define PTR_WIRE (&twi) #else #define init_heltec_lora2() #define PTR_WIRE (&Wire) #endif Adafruit_SSD1306 display(LV_HOR_RES_MAX,LV_VER_RES_MAX, PTR_WIRE, OLED_RESET); /** * Flush a buffer to the marked area * @param drv pointer to driver where this function belongs * @param area an area where to copy `color_p` * @param color_p an array of pixel to copy to the `area` part of the screen */ void cb_flush_adagfx(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { int row, col; lv_color_t * p = color_p; for (row = area->y1; row <= area->y2; row++) { for (col = area->x1; col <= area->x2; col++) { if (lv_color_brightness(*p) < 128) { //if (*p == LV_COLOR_BLACK) { display.drawPixel(col, row, SSD1306_BLACK); } else { display.drawPixel(col, row, SSD1306_WHITE); } p ++; } } lv_disp_flush_ready(disp_drv); } void cb_rounder_adagfx(struct _disp_drv_t * disp_drv, lv_area_t *a) { a->x1 = a->x1 & ~(0x7); a->x2 = a->x2 | (0x7); } void cb_set_px_adagfx(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) { buf += buf_w/8 * y; buf += x/8; if(lv_color_brightness(color) < 128) { //if (*p == LV_COLOR_BLACK) { (*buf) &= ~(1 << (7 - x % 8)); } else { (*buf) |= (1 << (7 - x % 8)); } } //////////////////////////////////////////////////////////////////////////////// void hw_init(void) { #if defined(ARDUINO) Serial.begin(115200); // Wait for USB Serial. while (!Serial) {} delay(200); // Read any input while (Serial.read() >= 0) {} #endif setup_rotary(); /* Add a display * Use the 'monitor' driver which creates window on PC's monitor to simulate a display*/ display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); static lv_disp_buf_t disp_buf; static lv_color_t buf[LV_HOR_RES_MAX * LV_VER_RES_MAX / 8 / 8]; /*Declare a buffer for 10 lines*/ lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX / 8 / 8); /*Initialize the display buffer*/ lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); /*Basic initialization*/ disp_drv.flush_cb = cb_flush_adagfx; /*Used when `LV_VDB_SIZE != 0` in lv_conf.h (buffered drawing)*/ //disp_drv.set_px_cb = cb_set_px_adagfx; //disp_drv.rounder_cb = cb_rounder_adagfx; disp_drv.buffer = &disp_buf; //disp_drv.disp_fill = monitor_fill; /*Used when `LV_VDB_SIZE == 0` in lv_conf.h (unbuffered drawing)*/ //disp_drv.disp_map = monitor_map; /*Used when `LV_VDB_SIZE == 0` in lv_conf.h (unbuffered drawing)*/ lv_disp_drv_register(&disp_drv); /* Add the rotary encoder as input device */ lv_indev_drv_t indev_drv; lv_indev_drv_init(&indev_drv); /*Basic initialization*/ indev_drv.type = LV_INDEV_TYPE_ENCODER; indev_drv.read_cb = rotary_encoder_lv_read; lv_indev_t* encoder_indev = lv_indev_drv_register(&indev_drv); rotary_group_init(encoder_indev); /* Tick init. * You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about how much time were elapsed * Create an SDL thread to do this*/ } static int pre_lvtick = 0; static int pre_disp = 0; void hw_loop(void) { int cur; loop_rotary(); cur = millis(); if (pre_lvtick + 5 < cur) { pre_lvtick = cur; lv_tick_inc(5); lv_task_handler(); } if (pre_disp + 50 < cur) { pre_disp = cur; display.display(); } }
29.614907
145
0.630663
yhfudev
1f595b1d26cbca32ab1722cc106f0f695510ce3f
3,105
cpp
C++
source/Debug/debug.cpp
Vadru93/LevelMod
85738a89f6df2dbd50deacdbc895b30c77e016b9
[ "BSD-2-Clause" ]
13
2020-08-24T10:46:26.000Z
2022-02-08T23:59:11.000Z
source/Debug/debug.cpp
Vadru93/LevelMod
85738a89f6df2dbd50deacdbc895b30c77e016b9
[ "BSD-2-Clause" ]
112
2020-08-25T11:42:53.000Z
2022-01-04T14:25:26.000Z
source/Debug/debug.cpp
Vadru93/LevelMod
85738a89f6df2dbd50deacdbc895b30c77e016b9
[ "BSD-2-Clause" ]
1
2021-02-17T18:11:52.000Z
2021-02-17T18:11:52.000Z
#define _CRT_SECURE_NO_WARNINGS #include "pch.h" #include "debug.h" void Tracer(LPCSTR format, ...) { if (format) { va_list vl; char str[4096]; va_start(vl, format); _vsnprintf(str, (sizeof(str) - 1), format, vl); str[(sizeof(str) - 1)] = 0; va_end(vl); // Output to debugger channel OutputDebugString(str); printf(str); } } #ifdef _DEBUG namespace LevelModSettings { extern bool bLogging; } #endif extern FILE* logFile; extern CRITICAL_SECTION critical; void DebugPrint(const char* file, DWORD line, const char* date, const char* string, ...) { EnterCriticalSection(&critical); static char debug_msg[MAX_PATH]; va_list myargs; va_start(myargs, string); vsprintf(debug_msg, string, myargs); va_end(myargs); printf(debug_msg); if (logFile) { if (*debug_msg != '\n') fprintf(logFile, "File %s line %u compiled %s\n", file, line, date); fprintf(logFile, debug_msg); fflush(logFile); } LeaveCriticalSection(&critical); } char* AddressToMappedName(HANDLE hOwner, PVOID pAddress, char* szBuffer, int iSize) { if (szBuffer && (iSize > 0)) { ZeroMemory(szBuffer, iSize); char szFullPath[MAX_PATH]; if (GetMappedFileName(hOwner, pAddress, szFullPath, (sizeof(szFullPath) - 1))) { // Remove the path, keeping just the base name // TODO: You might optionally want the full path szFullPath[sizeof(szFullPath) - 1] = 0; char szFileName[_MAX_FNAME + _MAX_EXT], szExtension[_MAX_EXT]; _splitpath(szFullPath, NULL, NULL, szFileName, szExtension); _snprintf(szBuffer, (iSize - 1), "%s%s", szFileName, szExtension); szBuffer[(iSize - 1)] = 0; return(szBuffer); } // Try alternate way, since first failed { HMODULE hModule = NULL; if (pAddress) { // Try it as a module handle first GetModuleHandleEx((GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS), (LPCTSTR)pAddress, &hModule); if (!hModule) hModule = (HMODULE)pAddress; } if (GetModuleBaseName(hOwner, hModule, szBuffer, (iSize - 1)) > 0) return(szBuffer); else // Fix weird bug where GetModuleBaseName() puts a random char in [0] on failure szBuffer[0] = 0; } } return(NULL); } bool ReportException(LPCTSTR pszFunction, LPEXCEPTION_POINTERS pExceptionInfo) { char szModule[MAX_PATH] = { "Unknown" }; AddressToMappedName(GetCurrentProcess(), pExceptionInfo->ExceptionRecord->ExceptionAddress, szModule, sizeof(szModule)); Tracer("DLL: ** Exception: %08X, @ %08X, in \"%s\", from Module: \"%s\", Base: %08X **\n", pExceptionInfo->ExceptionRecord->ExceptionCode, pExceptionInfo->ExceptionRecord->ExceptionAddress, pszFunction, szModule, GetModuleHandle(szModule)); return(false); }
31.683673
245
0.612238
Vadru93
1f5aa6bd8d4afdad744fe799c239f71a9fb1893c
5,586
cpp
C++
src/ui/c_load_builder_dialog.cpp
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
src/ui/c_load_builder_dialog.cpp
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
src/ui/c_load_builder_dialog.cpp
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
#include "c_load_builder_dialog.h" #include "ui_c_load_builder_dialog.h" c_save_builder_model *c_load_builder_dialog::model = nullptr; c_load_builder_dialog::c_load_builder_dialog(c_dbmanager *manager, QWidget *parent) : QDialog(parent), ui(new Ui::c_load_builder_dialog) { ui->setupUi(this); ui->widget->setStyleSheet(QString("QWidget#widget{background-color : %1;} QLabel{color : white;}").arg(app_color::grey_blue_2)); this->setWindowTitle("Ouvrir un build"); if (model == nullptr) { model = new c_save_builder_model(manager); } ui->tableView->setModel(model); ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableView->resizeColumnsToContents(); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); QObject::connect(ui->tableView,&QTableView::clicked,this,&c_load_builder_dialog::slot_table_cliked); ui->label_2->setStyleSheet("color:white;"); ui->label_4->setStyleSheet("color:white;"); ui->label_5->setStyleSheet("color:white;"); ui->niveau->setText(""); ui->niveau->setStyleSheet("color:white;"); ui->name->setText(""); ui->name->setStyleSheet("color:white;"); ui->classe->setPixmap(QPixmap(":/images/portrait/aleat.png")); ui->label_4->hide(); ui->tableView->verticalHeader()->setVisible(false); qDebug() << ui->tableView->styleSheet(); ui->tableView->setFocusPolicy(Qt::NoFocus); ui->tableView->setShowGrid(false); ui->tableView->setStyleSheet(QString(" QTableView#tableView{" " border : 1px solid white;" " border-radius : 3px;" " background-color : %1;" "} " "QTableView::item{" " background-color : %1; " " border-bottom : 1px solid #BBBBBB;" " border-top : 1px solid #BBBBBB; " "}" "QTableView::item:selected {" " color : white;" " background-color: %2; " " border-bottom : 1px solid #BBBBBB;" " border-top : 1px solid #BBBBBB; " "} " "QHeaderView::section { " " background-color: %1; border : 1px solid %1; color : white;" "}" "QHeaderView {" " border-bottom : 1px solid white;" "} ").arg(app_color::grey_blue).arg(app_color::green_blue)); QObject::connect(ui->tableView,&QTableView::doubleClicked,this,&c_load_builder_dialog::slot_double_clicked); button_deleg = new c_button_delegate(ui->tableView); button_deleg->setModel(model); ui->tableView->setItemDelegate(button_deleg); ui->tableView->setSelectionMode(QAbstractItemView::NoSelection); ui->tableView->setColumnWidth(0,30); ui->tableView->setColumnWidth(1,50); ui->tableView->setColumnWidth(2,193); ui->tableView->setColumnWidth(3,30); correct_scroll = false; ui->tableView->horizontalScrollBar()->setEnabled(false); QObject::connect(ui->tableView->horizontalScrollBar(),&QScrollBar::sliderMoved,this,&c_load_builder_dialog::slot_scrollbar_moved); QObject::connect(ui->tableView->horizontalScrollBar(),&QScrollBar::rangeChanged,this,&c_load_builder_dialog::slot_scrollbar_moved); // ui->tableView->horizontalHeader(); ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); } c_load_builder_dialog::~c_load_builder_dialog() { delete ui; } QString c_load_builder_dialog::getCurrent_json() const { return current_json; } int c_load_builder_dialog::getCurrent_id() const { return current_id; } void c_load_builder_dialog::init_model(c_dbmanager *manager) { model = new c_save_builder_model(manager); } void c_load_builder_dialog::slot_table_cliked(const QModelIndex &index) { ui->tableView->selectionModel()->clearSelection(); for (int i = 0; i < model->columnCount(index); ++i) { ui->tableView->selectionModel()->setCurrentIndex(model->index(index.row(),i),QItemSelectionModel::Select); } qDebug() << ui->tableView->verticalHeader()->size(); ui->tableView->horizontalScrollBar()->setValue(0); //ui.textEdit->verticalScrollBar()->setValue(0); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); current_json = model->getJson(index); current_id = model->getId(index); ui->niveau->setNum(model->getLvl(index)); ui->name->setText(model->getName(index)); QString url = model->getUrlImage(index); ui->classe->setPixmap(QPixmap(url)); } void c_load_builder_dialog::slot_double_clicked() { if (current_json.isEmpty()) return; accept(); } void c_load_builder_dialog::slot_scrollbar_moved() { qDebug() << "slide moved" << correct_scroll; if (!correct_scroll) { ui->tableView->horizontalScrollBar()->setValue(0); correct_scroll = true; } else { correct_scroll = false; } } void c_load_builder_dialog::slot_debug() { qDebug() << "focused changed"; }
44.333333
135
0.591837
Mankio
48f2c40de243e4ad583a87975cfab95a08567263
2,467
cpp
C++
snippets/0x05/b_pointer_05_swap.cpp
pblan/fha-cpp
5008f54133cf4913f0ca558a3817b01b10d04494
[ "CECILL-B" ]
null
null
null
snippets/0x05/b_pointer_05_swap.cpp
pblan/fha-cpp
5008f54133cf4913f0ca558a3817b01b10d04494
[ "CECILL-B" ]
null
null
null
snippets/0x05/b_pointer_05_swap.cpp
pblan/fha-cpp
5008f54133cf4913f0ca558a3817b01b10d04494
[ "CECILL-B" ]
null
null
null
// author: [email protected] #include <iostream> using std::cout; using std::endl; // #pragma GCC diagnostic ignored "-Wunused-but-set-parameter" void init1(int n); // (A) void init2(int& n); void init3(int* n); void swap1(int n, int m); void swap2(int& n, int& m); void swap3(int* n, int* m); int main() { cout << endl << "--- " << __FILE__ << " ---" << endl << endl; int n{}, m{}; n=1; init1(n); // (B) cout << "01| n=" << n << endl; n=2; init2(n); cout << "02| n=" << n << endl; n=3; init3(&n); cout << "03| n=" << n << endl; cout << "-----" << endl; n=1; m=-1; swap1(n,m); cout << "04| n=" << n << ", m=" << m << endl; n=2; m=-2; swap2(n,m); cout << "05| n=" << n << ", m=" << m << endl; n=3; m=-3; swap3(&n,&m); cout << "06| n=" << n << ", m=" << m << endl; cout << endl << "--- " << __FILE__ << " ---" << endl << endl; return 0; } void init1(int n) { n=0; } void init2(int& n) { n=0; } void init3(int* n) { *n=0; } void swap1(int n, int m) { int k = n; n = m; m = k; } void swap2(int& n, int& m) { int k = n; n = m; m = k; } void swap3(int* n, int* m) { int k = *n; *n = *m; *m = k; } /* Kommentierung * * (A) Es gibt zwei Funktionen 'init' und 'swap'. Die erste soll das * aufrufende Argument auf 0 setzen, die zweite soll die Argumente * tauschen - und zwar jeweils die Originalparameter vom Aufruf! * Das klappt nicht immer, waum? * Beide Funktionen gibt es in jeweils drei Varianten: * In der ersten wird die Funktion 'call-by-value' * aufgerufen, in der zweiten und dritten 'call-by-ref' einmal * mit Referenzen und einmal mit Zeigern. * Die Frage lautet immer: was steht nach dem Aufruf in den Parametern * bzw. wurden sie verändert oder nicht? * * (B) Wie beschrieben, zuerst setzen wir Werte, damit man sieht, ob sich * was verändert hat oder nicht. * Die Lösung ist, dass beim Aufruf 'call-by-value' die Parameter kopiert * werden und daher die Originalparameter vom Aufruf nicht verändert werden. * Bei 'call-by-ref' dagegen werden die Originalparameter verändert, * entweder weil es sich um Referenzen, also Aliase, handelt oder * weil über die Zeiger auch die Originalparameter im Zugriff sind. * */
25.43299
81
0.535063
pblan
48f339e44b91598999d4ecc386d476f568dacefd
96
cpp
C++
test/cpp_prj/src/file_set_test/house/included_file_in_partition2.cpp
JaniHonkanen/RabbitCall
2652e201ebcd6697cd25ec7e18163afa002c1016
[ "MIT" ]
null
null
null
test/cpp_prj/src/file_set_test/house/included_file_in_partition2.cpp
JaniHonkanen/RabbitCall
2652e201ebcd6697cd25ec7e18163afa002c1016
[ "MIT" ]
null
null
null
test/cpp_prj/src/file_set_test/house/included_file_in_partition2.cpp
JaniHonkanen/RabbitCall
2652e201ebcd6697cd25ec7e18163afa002c1016
[ "MIT" ]
null
null
null
#include "pch.h" #include "included_file_in_partition2.h" int partition2Test() { return 22; }
13.714286
40
0.739583
JaniHonkanen
48fb908b5742af84c3a526c8030fea32af382ba7
3,726
cpp
C++
src/meshInfo/geometry.cpp
guhanfeng/HSF
d2f091e990bb5a18473db0443872e37de6b6a83f
[ "Apache-2.0" ]
null
null
null
src/meshInfo/geometry.cpp
guhanfeng/HSF
d2f091e990bb5a18473db0443872e37de6b6a83f
[ "Apache-2.0" ]
null
null
null
src/meshInfo/geometry.cpp
guhanfeng/HSF
d2f091e990bb5a18473db0443872e37de6b6a83f
[ "Apache-2.0" ]
null
null
null
/** * @file: geometry.cpp * @author: Liu Hongbin * @brief: * @date: 2019-11-28 10:57:45 * @last Modified by: lenovo * @last Modified time: 2019-11-28 16:14:40 */ #include "geometry.hpp" namespace HSF { scalar calculateQUADArea(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z) { scalar v1[3], v2[3], v3[3]; /// v1 = coord(1)-coord(0) v1[0] = x[1] - x[0]; v1[1] = y[1] - y[0]; v1[2] = z[1] - z[0]; /// v2 = coord(3)-coord(0) v2[0] = x[3] - x[0]; v2[1] = y[3] - y[0]; v2[2] = z[3] - z[0]; /// v3 = v1xv2 v3[0] = v1[1]*v2[2]-v2[1]*v1[2]; v3[1] = v1[2]*v2[0]-v2[2]*v1[0]; v3[2] = v1[0]*v2[1]-v2[0]*v1[1]; // v3(1) = v1(2)*v2(3)-v2(2)*v1(3) // v3(2) = v1(3)*v2(1)-v1(1)*v2(3) // v3(3) = v1(1)*v2(2)-v2(1)*v1(2) return sqrt(v3[0]*v3[0]+v3[1]*v3[1]+v3[2]*v3[2]); } scalar calculateTRIArea(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z) { } scalar calculateFaceArea(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, label nnodes) { switch(nnodes) { // case 3: return calculateTRIArea(x, y, z); case 4: return calculateQUADArea(x, y, z); break; default: Terminate("calculateFaceArea", "unrecognized face type"); } } void calculateQUADNormVec(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, scalar* normVec) { scalar v1[3], v2[3], v3[3]; // for (int i = 0; i < x.size(); ++i) // { // printf("%f, %f, %f\n", x[i], y[i], z[i]); // } /// v1 = coord(1)-coord(0) v1[0] = x[1] - x[0]; v1[1] = y[1] - y[0]; v1[2] = z[1] - z[0]; /// v2 = coord(3)-coord(0) v2[0] = x[3] - x[0]; v2[1] = y[3] - y[0]; v2[2] = z[3] - z[0]; /// v3 = v1xv2 v3[0] = v1[1]*v2[2]-v2[1]*v1[2]; v3[1] = v1[2]*v2[0]-v2[2]*v1[0]; v3[2] = v1[0]*v2[1]-v2[0]*v1[1]; scalar norm = sqrt(v3[0]*v3[0]+v3[1]*v3[1]+v3[2]*v3[2]); normVec[0] = v3[0]/norm; normVec[1] = v3[1]/norm; normVec[2] = v3[2]/norm; // printf("normVec: %f, %f, %f\n", normVec[0], normVec[1], normVec[2]); } void calculateFaceNormVec(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, label nnodes, scalar* normVec) { switch(nnodes) { case 4: calculateQUADNormVec(x, y, z, normVec); break; default: Terminate("calculateFaceNormVec", "unrecognized face type"); } } void calculateFaceCenter(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, label nnodes, scalar* center) { center[0] = 0; center[1] = 0; center[2] = 0; for (int i = 0; i < nnodes; ++i) { center[0] += x[i]; center[1] += y[i]; center[2] += z[i]; } center[0] /= nnodes; center[1] /= nnodes; center[2] /= nnodes; } scalar calculateCellVol(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, label nnodes) { switch(nnodes) { // case 3: return calculateTRIArea(x, y, z); case 8: return calculateHEXAVol(x, y, z); break; default: Terminate("calculateCellVol", "unrecognized cell type"); } } scalar calculateHEXAVol(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z) { scalar v1[3], v2[3], v3[3]; v1[0] = x[1] - x[0]; v1[1] = y[1] - y[0]; v1[2] = z[1] - z[0]; v2[0] = x[3] - x[0]; v2[1] = y[3] - y[0]; v2[2] = z[3] - z[0]; v3[0] = x[4] - x[0]; v3[1] = y[4] - y[0]; v3[2] = z[4] - z[0]; scalar vol; vol = v3[0]*(v1[1]*v2[2]-v2[1]*v1[2]); vol = vol+v3[1]*(v1[2]*v2[0]-v1[0]*v2[2]); vol = vol+v3[2]*(v1[0]*v2[1]-v2[0]*v1[1]); return vol; } void calculateCellCenter(const Array<scalar>& x, const Array<scalar>& y, const Array<scalar>& z, label nnodes, scalar* center) { calculateFaceCenter(x, y, z, nnodes, center); } }
23
75
0.553945
guhanfeng
48fcaffb5e2c08a64895be09ec2083923ec00ff5
1,690
cpp
C++
tests/runtime_test.cpp
ElDesalmado/endian_converter
6cdaae26e01d3f5b77b053fce7a0b494e69b1605
[ "MIT" ]
null
null
null
tests/runtime_test.cpp
ElDesalmado/endian_converter
6cdaae26e01d3f5b77b053fce7a0b494e69b1605
[ "MIT" ]
null
null
null
tests/runtime_test.cpp
ElDesalmado/endian_converter
6cdaae26e01d3f5b77b053fce7a0b494e69b1605
[ "MIT" ]
null
null
null
 #include <gtest/gtest.h> #include <endian_converter/endian_converter.h> #include <array> #include <numeric> #include <algorithm> using namespace eld; template<typename T> bool test_endian_conversion() { std::array<uint8_t, sizeof(T)> input{}, expected{}, output{}; std::iota(input.begin(), input.end(), 1); std::copy(input.rbegin(), input.rend(), expected.begin()); T from{}; std::copy(input.cbegin(), input.cend(), reinterpret_cast<uint8_t *>(&from)); T swapped = swap_endian_v(from); uint8_t *begin = reinterpret_cast<uint8_t *>(&swapped), *end = std::next(begin, sizeof(T)); std::copy(begin, end, output.begin()); return std::equal(expected.cbegin(), expected.cend(), output.cbegin()); } TEST(EndianConversion, uint8_t) { ASSERT_TRUE(test_endian_conversion<uint8_t>()); } TEST(EndianConversion, uint16_t) { ASSERT_TRUE(test_endian_conversion<uint16_t>()); } TEST(EndianConversion, uint32_t) { ASSERT_TRUE(test_endian_conversion<uint32_t>()); } TEST(EndianConversion, uint64_t) { ASSERT_TRUE(test_endian_conversion<uint64_t>()); } TEST(EndianConversion, TestFloat) { ASSERT_TRUE(test_endian_conversion<float>()); } TEST(EndianConversio, TestDouble) { ASSERT_TRUE(test_endian_conversion<double>()); } struct abc { int a; float b; int c; }; TEST(EndianConversio, TestStruct) { ASSERT_TRUE(test_endian_conversion<abc>()); } //TEST(EndianConversio, TestLongDouble) //{ // ASSERT_TRUE(test_endian_conversion<long double>()); //} int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
19.882353
80
0.672189
ElDesalmado
48fe27e5cab98f6389e1795176c3f4da009c043b
713
cpp
C++
CSC201/in-class/Wk8/Wk-8b.cpp
ochudi/ochudi-CSC201
3a792beef4780960c725ef9bf6c4af96110c373d
[ "MIT" ]
null
null
null
CSC201/in-class/Wk8/Wk-8b.cpp
ochudi/ochudi-CSC201
3a792beef4780960c725ef9bf6c4af96110c373d
[ "MIT" ]
null
null
null
CSC201/in-class/Wk8/Wk-8b.cpp
ochudi/ochudi-CSC201
3a792beef4780960c725ef9bf6c4af96110c373d
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; class csc201 { public: // access specifier int score; // attribute score string name; // attribute name char grade; // attribute grade }; int main() { csc201 student1; csc201 student2; student1.score = 20; student1.grade = 'F'; student1.name = "Bello Moses Eromosele"; student2.score = 100; student2.grade = 'A'; student2.name = "Chudi Peter Ofoma"; cout << "(Student 1) Name: " << student1.name << "; Grade: " << student1.grade << "; Score: " << student1.score << endl; cout << "(Student 2) Name: " << student2.name << "; Grade: " << student2.grade << "; Score: " << student2.score << endl; }
28.52
124
0.58906
ochudi
48fe4f78ca022862ef87f873388f1dacd0873158
6,259
cpp
C++
libconsensus/ConsensusEngineBase.cpp
michealbrownm/phantom
a1a41a6f9317c26e621952637c7e331c8dacf79d
[ "Apache-2.0" ]
27
2020-09-24T03:14:13.000Z
2021-11-29T14:00:36.000Z
libconsensus/ConsensusEngineBase.cpp
david2011dzha/phantom
eff76713e03966eb44e20a07806b8d47ec73ad09
[ "Apache-2.0" ]
null
null
null
libconsensus/ConsensusEngineBase.cpp
david2011dzha/phantom
eff76713e03966eb44e20a07806b8d47ec73ad09
[ "Apache-2.0" ]
10
2020-09-24T14:34:30.000Z
2021-02-22T06:50:31.000Z
/* * @CopyRight: * FISCO-BCOS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FISCO-BCOS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FISCO-BCOS. If not, see <http://www.gnu.org/licenses/> * (c) 2016-2018 fisco-dev contributors. */ /** * @brief : implementation of PBFT consensus * @file: ConsensusEngineBase.cpp * @author: yujiechen * @date: 2018-09-28 */ #include "ConsensusEngineBase.h" using namespace dev::eth; using namespace dev::db; using namespace dev::blockverifier; using namespace dev::blockchain; using namespace dev::p2p; namespace dev { namespace consensus { void ConsensusEngineBase::start() { if (m_startConsensusEngine) { ENGINE_LOG(WARNING) << "[ConsensusEngineBase has already been started]"; return; } ENGINE_LOG(INFO) << "[Start ConsensusEngineBase]"; /// start a thread to execute doWork()&&workLoop() startWorking(); m_startConsensusEngine = true; } void ConsensusEngineBase::stop() { if (m_startConsensusEngine == false) { return; } ENGINE_LOG(INFO) << "[Stop ConsensusEngineBase]"; m_startConsensusEngine = false; doneWorking(); if (isWorking()) { stopWorking(); // will not restart worker, so terminate it terminate(); } } /// update m_sealing and receiptRoot dev::blockverifier::ExecutiveContext::Ptr ConsensusEngineBase::executeBlock(Block& block) { auto parentBlock = m_blockChain->getBlockByNumber(m_blockChain->number()); BlockInfo parentBlockInfo{parentBlock->header().hash(), parentBlock->header().number(), parentBlock->header().stateRoot()}; /// reset execute context return m_blockVerifier->executeBlock(block, parentBlockInfo); } void ConsensusEngineBase::checkBlockValid(Block const& block) { h256 block_hash = block.blockHeader().hash(); /// check transaction num if (block.getTransactionSize() > maxBlockTransactions()) { ENGINE_LOG(DEBUG) << LOG_DESC("checkBlockValid: overthreshold transaction num") << LOG_KV("blockTransactionLimit", maxBlockTransactions()) << LOG_KV("blockTransNum", block.getTransactionSize()); BOOST_THROW_EXCEPTION( OverThresTransNum() << errinfo_comment("overthreshold transaction num")); } /// check the timestamp if (block.blockHeader().timestamp() > utcTime() && !m_allowFutureBlocks) { ENGINE_LOG(DEBUG) << LOG_DESC("checkBlockValid: future timestamp") << LOG_KV("timestamp", block.blockHeader().timestamp()) << LOG_KV("utcTime", utcTime()) << LOG_KV("hash", block_hash.abridged()); BOOST_THROW_EXCEPTION(DisabledFutureTime() << errinfo_comment("Future time Disabled")); } /// check the block number if (block.blockHeader().number() <= m_blockChain->number()) { ENGINE_LOG(DEBUG) << LOG_DESC("checkBlockValid: old height") << LOG_KV("highNumber", m_blockChain->number()) << LOG_KV("blockNumber", block.blockHeader().number()) << LOG_KV("hash", block_hash.abridged()); BOOST_THROW_EXCEPTION(InvalidBlockHeight() << errinfo_comment("Invalid block height")); } /// check the existence of the parent block (Must exist) if (!blockExists(block.blockHeader().parentHash())) { ENGINE_LOG(DEBUG) << LOG_DESC("checkBlockValid: Parent doesn't exist") << LOG_KV("hash", block_hash.abridged()); BOOST_THROW_EXCEPTION(ParentNoneExist() << errinfo_comment("Parent Block Doesn't Exist")); } if (block.blockHeader().number() > 1) { if (m_blockChain->numberHash(block.blockHeader().number() - 1) != block.blockHeader().parentHash()) { ENGINE_LOG(DEBUG) << LOG_DESC("checkBlockValid: Invalid block for unconsistent parentHash") << LOG_KV("block.parentHash", block.blockHeader().parentHash().abridged()) << LOG_KV("parentHash", m_blockChain->numberHash(block.blockHeader().number() - 1).abridged()); BOOST_THROW_EXCEPTION( WrongParentHash() << errinfo_comment("Invalid block for unconsistent parentHash")); } } } void ConsensusEngineBase::updateConsensusNodeList() { try { std::stringstream s2; s2 << "[updateConsensusNodeList] Sealers:"; { WriteGuard l(m_sealerListMutex); m_sealerList = m_blockChain->sealerList(); /// to make sure the index of all sealers are consistent std::sort(m_sealerList.begin(), m_sealerList.end()); for (dev::h512 node : m_sealerList) s2 << node.abridged() << ","; } s2 << "Observers:"; dev::h512s observerList = m_blockChain->observerList(); for (dev::h512 node : observerList) s2 << node.abridged() << ","; ENGINE_LOG(TRACE) << s2.str(); if (m_lastNodeList != s2.str()) { ENGINE_LOG(TRACE) << "[updateConsensusNodeList] update P2P List done."; updateNodeListInP2P(); m_lastNodeList = s2.str(); } } catch (std::exception& e) { ENGINE_LOG(ERROR) << "[updateConsensusNodeList] update consensus node list failed [EINFO]: " << boost::diagnostic_information(e); } } void ConsensusEngineBase::updateNodeListInP2P() { dev::h512s nodeList = m_blockChain->sealerList() + m_blockChain->observerList(); std::pair<GROUP_ID, MODULE_ID> ret = getGroupAndProtocol(m_protocolId); m_service->setNodeListByGroupID(ret.first, nodeList); } } // namespace consensus } // namespace dev
36.389535
99
0.634926
michealbrownm
48fff39706b19c8bd6ffbfef4cf9ceff56e06f2e
779
hpp
C++
Nacro/SDK/FN_EnemyPawn_Interface_parameters.hpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
11
2021-08-08T23:25:10.000Z
2022-02-19T23:07:22.000Z
Nacro/SDK/FN_EnemyPawn_Interface_parameters.hpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
1
2022-01-01T22:51:59.000Z
2022-01-08T16:14:15.000Z
Nacro/SDK/FN_EnemyPawn_Interface_parameters.hpp
Milxnor/Nacro
eebabf662bbce6d5af41820ea0342d3567a0aecc
[ "BSD-2-Clause" ]
8
2021-08-09T13:51:54.000Z
2022-01-26T20:33:37.000Z
#pragma once // Fortnite (1.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace SDK { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function EnemyPawn_Interface.EnemyPawn_Interface_C.Orphaned struct UEnemyPawn_Interface_C_Orphaned_Params { bool IsOrphaned; // (Parm, OutParm, ZeroConstructor, IsPlainOldData) class AFortPawn* AttachedPawn; // (Parm, OutParm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
26.862069
161
0.441592
Milxnor
5b03732d4054b2f2c65bbce4f3fb77cdb6d1794d
3,665
cpp
C++
Source/Windows.Test/HresultTest.cpp
andrei-datcu/arcana.cpp
3c4757cbee49b3272130bf8b72094c2c62fd36c5
[ "MIT" ]
65
2019-05-08T01:53:22.000Z
2022-03-25T15:05:38.000Z
Source/Windows.Test/HresultTest.cpp
andrei-datcu/arcana.cpp
3c4757cbee49b3272130bf8b72094c2c62fd36c5
[ "MIT" ]
12
2019-08-13T03:18:30.000Z
2022-01-03T20:12:24.000Z
Source/Windows.Test/HresultTest.cpp
andrei-datcu/arcana.cpp
3c4757cbee49b3272130bf8b72094c2c62fd36c5
[ "MIT" ]
18
2019-05-09T23:07:44.000Z
2021-12-26T14:24:29.000Z
// // Copyright (C) Microsoft Corporation. All rights reserved. // #include <arcana/hresult.h> #include <arcana/type_traits.h> #include <future> #include <CppUnitTest.h> #include <bitset> using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace UnitTests { namespace { constexpr unsigned int bits(int bytes) { return bytes * 8; } } TEST_CLASS(HresultTest) { TEST_METHOD(ConvertHresult) { const arcana::hresult failure = arcana::hresult::dxgi_error_device_removed; const std::error_code code = arcana::error_code_from_hr(failure); Assert::AreEqual(arcana::underlying_cast(failure), arcana::hr_from_error_code(code)); } TEST_METHOD(ConvertStandardErrorCode) { const auto code = make_error_code(std::errc::argument_out_of_domain); const int32_t hresult = arcana::hr_from_error_code(code); Assert::IsTrue(code == arcana::error_code_from_hr(hresult)); } TEST_METHOD(VerifyCustomHResultFailureBitIsSet) { auto cameraError = make_error_code(std::errc::broken_pipe); auto hresultError = arcana::hr_from_error_code(cameraError); ::std::bitset<bits(sizeof(int32_t))> hresultBitset(hresultError); Assert::IsTrue(hresultBitset.test(31)); } TEST_METHOD(VerifyCustomHResultCustomerBitIsSet) { auto cameraError = make_error_code(std::errc::broken_pipe); auto hresultError = arcana::hr_from_error_code(cameraError); ::std::bitset<bits(sizeof(int32_t))> hresultBitset(hresultError); Assert::IsTrue(hresultBitset.test(29)); } TEST_METHOD(VerifyCustomHResultCategoryIsDifferent) { auto genericError = arcana::hr_from_error_code(make_error_code(std::errc::bad_file_descriptor)); auto futureError = arcana::hr_from_error_code(make_error_code(std::future_errc::no_state)); ::std::bitset<bits(sizeof(int32_t))> genericErrorBits(genericError); ::std::bitset<bits(sizeof(int32_t))> futureErrorBits(futureError); ::std::bitset<bits(sizeof(int32_t))> maxErrC = (0xFFFF); // verify bits 17 through 26 are not identical between two different categories (they should be unique) auto filteredGenericBits = (genericErrorBits | maxErrC) ^ maxErrC; auto filteredarcanaBits = (futureErrorBits | maxErrC) ^ maxErrC; Assert::IsTrue(filteredGenericBits != filteredarcanaBits); } TEST_METHOD(VerifyCanGetGenericErrorFromHResult) { auto genericError = arcana::hr_from_error_code(make_error_code(std::errc::broken_pipe)); auto category = arcana::get_category_from_hresult(genericError); Assert::IsFalse(category == nullptr); Assert::IsTrue(*category == std::generic_category()); } TEST_METHOD(VerifyStandardHResultDoesNotReturnCategory) { auto category = arcana::get_category_from_hresult(E_FAIL); Assert::IsTrue(category == nullptr); } TEST_METHOD(VerifyConvertToFromHResult) { auto cameraError = make_error_code(std::errc::broken_pipe); auto hresultError = arcana::hr_from_error_code(cameraError); auto newCameraError = arcana::error_code_from_hr(hresultError); Assert::IsTrue(cameraError.category() == newCameraError.category()); Assert::IsTrue(cameraError.value() == newCameraError.value()); } }; }
36.287129
115
0.65075
andrei-datcu
5b041a9797da2b0aa8d3df1d5c7efbab983a5262
977
hpp
C++
src/cpu/interrupts/idt.hpp
Tunacan427/FishOS
86a173e8c423e96e70dfc624b5738e1313b0b130
[ "MIT" ]
null
null
null
src/cpu/interrupts/idt.hpp
Tunacan427/FishOS
86a173e8c423e96e70dfc624b5738e1313b0b130
[ "MIT" ]
null
null
null
src/cpu/interrupts/idt.hpp
Tunacan427/FishOS
86a173e8c423e96e70dfc624b5738e1313b0b130
[ "MIT" ]
null
null
null
#pragma once #include <kstd/types.hpp> namespace cpu::interrupts { struct [[gnu::packed]] IDTR { u16 limit; u64 base; }; enum class IDTType { INTERRUPT = 0b1110, TRAP = 0b1111 }; struct [[gnu::packed]] IDTEntry { u16 offset1; u16 selector; u16 attributes; u16 offset2; u32 offset3; u32 reserved; }; struct [[gnu::packed]] InterruptFrame { u64 r15, r14, r13, r12, r11, r10, r9, r8; u64 rbp, rdi, rsi, rdx, rcx, rbx, rax; u64 vec; // vector number, set by the wrapper u64 err; // might be pushed by the cpu, set to 0 by the wrapper if not u64 rip, cs, rflags, rsp, ss; // all pushed by the cpu }; typedef void (*IDTHandler)(InterruptFrame*); u8 allocate_vector(); void load_idt_entry(u8 index, void (*wrapper)(), IDTType type); void load_idt_handler(u8 index, IDTHandler handler); void load_idt(); }
24.425
78
0.579324
Tunacan427
5b0fe82587c2b51fcf41f9bc58048d190df3d79e
495
cpp
C++
codes/UVA/01001-01999/uva1160.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/UVA/01001-01999/uva1160.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/UVA/01001-01999/uva1160.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1e5; int f[maxn+5]; int getfar(int x) { return x == f[x] ? x : f[x] = getfar(f[x]); } int main () { int x, y; while (scanf("%d", &x) == 1) { int ret = 0; for (int i = 0; i <= maxn; i++) f[i] = i; while (x != -1) { scanf("%d", &y); x = getfar(x); y = getfar(y); if (x == y) ret++; else f[y] = x; scanf("%d", &x); } printf("%d\n", ret); } return 0; }
13.75
44
0.474747
JeraKrs
5b14f4a95cd297d9e5951f64d28481a2b9a7f468
4,077
cpp
C++
APEX_1.4/common/src/ApexAssetAuthoring.cpp
gongyiling/PhysX-3.4
99bc1c62880cf626f9926781e76a528b5276c68b
[ "Unlicense" ]
1,863
2018-12-03T13:06:03.000Z
2022-03-29T07:12:37.000Z
APEX_1.4/common/src/ApexAssetAuthoring.cpp
cctxx/PhysX-3.4-1
5e42a5f112351a223c19c17bb331e6c55037b8eb
[ "Unlicense" ]
71
2018-12-03T19:48:39.000Z
2022-01-11T09:30:52.000Z
APEX_1.4/common/src/ApexAssetAuthoring.cpp
cctxx/PhysX-3.4-1
5e42a5f112351a223c19c17bb331e6c55037b8eb
[ "Unlicense" ]
265
2018-12-03T14:30:03.000Z
2022-03-25T20:57:01.000Z
// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of NVIDIA CORPORATION nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Copyright (c) 2018 NVIDIA Corporation. All rights reserved. #include "ApexAssetAuthoring.h" #include "P4Info.h" #include "PsString.h" #include "PhysXSDKVersion.h" #include "ApexSDKIntl.h" namespace nvidia { namespace apex { void ApexAssetAuthoring::setToolString(const char* toolName, const char* toolVersion, uint32_t toolChangelist) { #ifdef WITHOUT_APEX_AUTHORING PX_UNUSED(toolName); PX_UNUSED(toolVersion); PX_UNUSED(toolChangelist); #else const uint32_t buflen = 256; char buf[buflen]; nvidia::strlcpy(buf, buflen, toolName); nvidia::strlcat(buf, buflen, " "); if (toolVersion != NULL) { nvidia::strlcat(buf, buflen, toolVersion); nvidia::strlcat(buf, buflen, ":"); } if (toolChangelist == 0) { toolChangelist = P4_TOOLS_CHANGELIST; } { char buf2[14]; shdfnd::snprintf(buf2, 14, "CL %d", toolChangelist); nvidia::strlcat(buf, buflen, buf2); nvidia::strlcat(buf, buflen, " "); } { #ifdef WIN64 nvidia::strlcat(buf, buflen, "Win64 "); #elif defined(WIN32) nvidia::strlcat(buf, buflen, "Win32 "); #endif } { nvidia::strlcat(buf, buflen, "(Apex "); nvidia::strlcat(buf, buflen, P4_APEX_VERSION_STRING); char buf2[20]; shdfnd::snprintf(buf2, 20, ", CL %d, ", P4_CHANGELIST); nvidia::strlcat(buf, buflen, buf2); #ifdef _DEBUG nvidia::strlcat(buf, buflen, "DEBUG "); #elif defined(PHYSX_PROFILE_SDK) nvidia::strlcat(buf, buflen, "PROFILE "); #endif nvidia::strlcat(buf, buflen, P4_APEX_BRANCH); nvidia::strlcat(buf, buflen, ") "); } { nvidia::strlcat(buf, buflen, "(PhysX "); char buf2[10] = { 0 }; #if PX_PHYSICS_VERSION_MAJOR == 0 shdfnd::snprintf(buf2, 10, "No) "); #elif PX_PHYSICS_VERSION_MAJOR == 3 shdfnd::snprintf(buf2, 10, "%d.%d) ", PX_PHYSICS_VERSION_MAJOR, PX_PHYSICS_VERSION_MINOR); #endif nvidia::strlcat(buf, buflen, buf2); } nvidia::strlcat(buf, buflen, "Apex Build Time: "); nvidia::strlcat(buf, buflen, P4_BUILD_TIME); nvidia::strlcat(buf, buflen, "Distribution author: "); nvidia::strlcat(buf, buflen, AUTHOR_DISTRO); nvidia::strlcat(buf, buflen, "The reason for the creation of the distribution: "); nvidia::strlcat(buf, buflen, REASON_DISTRO); //uint32_t len = strlen(buf); //len = len; //"<toolName> <toolVersion>:<toolCL> <platform> (Apex <apexVersion>, CL <apexCL> <apexConfiguration> <apexBranch>) (PhysX <physxVersion>) <toolBuildDate>" setToolString(buf); #endif } void ApexAssetAuthoring::setToolString(const char* /*toolString*/) { PX_ALWAYS_ASSERT(); APEX_INVALID_OPERATION("Not Implemented."); } } // namespace apex } // namespace nvidia
29.330935
155
0.723817
gongyiling
5b1ca84deb08818f9c4d3e36db9805a75fbe8ef9
1,811
hh
C++
src/Utilities/coarsenBinnedValues.hh
jmikeowen/Spheral
3e1082a7aefd6b328bd3ae24ca1a477108cfc3c4
[ "BSD-Source-Code", "BSD-3-Clause-LBNL", "FSFAP" ]
22
2018-07-31T21:38:22.000Z
2020-06-29T08:58:33.000Z
src/Utilities/coarsenBinnedValues.hh
markguozhiming/spheral
bbb982102e61edb8a1d00cf780bfa571835e1b61
[ "BSD-Source-Code", "BSD-3-Clause-LBNL", "FSFAP" ]
41
2020-09-28T23:14:27.000Z
2022-03-28T17:01:33.000Z
src/Utilities/coarsenBinnedValues.hh
markguozhiming/spheral
bbb982102e61edb8a1d00cf780bfa571835e1b61
[ "BSD-Source-Code", "BSD-3-Clause-LBNL", "FSFAP" ]
7
2019-12-01T07:00:06.000Z
2020-09-15T21:12:39.000Z
//---------------------------------Spheral++----------------------------------// // coarsenBinnedValues // // Given a lattice of Values, return the multi-level result of progressively // coarsening the distribution a requeted number of levels. The passed // in vector<vector<Value> > should have the finest values as the last element, // and be sized the required number of levels you want to coarsen. This method // simply changes that vector<vector> in place. // // Created by JMO, Fri Feb 19 09:38:29 PST 2010 //----------------------------------------------------------------------------// #ifndef __Spheral_coarsenBinnedValues__ #define __Spheral_coarsenBinnedValues__ #include <vector> #include "Geometry/Dimension.hh" namespace Spheral { //------------------------------------------------------------------------------ // 1-D. //------------------------------------------------------------------------------ template<typename Value> void coarsenBinnedValues(std::vector<std::vector<Value> >& values, const unsigned nxFine); //------------------------------------------------------------------------------ // 2-D. //------------------------------------------------------------------------------ template<typename Value> void coarsenBinnedValues(std::vector<std::vector<Value> >& values, const unsigned nxFine, const unsigned nyFine); //------------------------------------------------------------------------------ // 3-D. //------------------------------------------------------------------------------ template<typename Value> void coarsenBinnedValues(std::vector<std::vector<Value> >& values, const unsigned nxFine, const unsigned nyFine, const unsigned nzFine); } #endif
36.22
80
0.44561
jmikeowen
5b21267a0977d054ae7cc9600c195fb64bb07e81
10,854
cpp
C++
SnakePredictor/Entity/SnakeEntity.cpp
DanielMcAssey/SnakePredictor
2e0c24b51df3089e8fa3bb1a354beec5f8ebfcb2
[ "MIT" ]
null
null
null
SnakePredictor/Entity/SnakeEntity.cpp
DanielMcAssey/SnakePredictor
2e0c24b51df3089e8fa3bb1a354beec5f8ebfcb2
[ "MIT" ]
null
null
null
SnakePredictor/Entity/SnakeEntity.cpp
DanielMcAssey/SnakePredictor
2e0c24b51df3089e8fa3bb1a354beec5f8ebfcb2
[ "MIT" ]
null
null
null
/* // This file is part of SnakePredictor // // (c) Daniel McAssey <[email protected]> // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. */ #include "stdafx.h" #include "../stdafx.h" #include "SnakeEntity.h" // Determine priority for path node (in the priority queue) bool operator<(const PathNode & a, const PathNode & b) { return a.Priority > b.Priority; } SnakeEntity::SnakeEntity(std::map<std::pair<int, int>, LevelSegment>* _level, int _initial_size, int _level_width, int _level_height, std::pair<int, int>* _level_food_location) { LevelGrid = _level; LevelWidth = _level_width; LevelHeight = _level_height; SnakeFoodLocation = _level_food_location; isDead = false; isFoodCollected = false; numFoodPoints = 0; // Create starting snake int startPosX = LevelWidth / 2; int startPosY = LevelHeight / 2; SnakePart* tmpPart = new SnakePart(); tmpPart->Location = std::make_pair(startPosX, startPosY); tmpPart->LastMovement = SNAKE_MOVE_LEFT; tmpPart->NewPart = false; SnakeParts.push_back(tmpPart); for (int i = 1; i < _initial_size; i++) { tmpPart = new SnakePart(); tmpPart->Location = std::make_pair(startPosX + i, startPosY); tmpPart->LastMovement = SNAKE_MOVE_LEFT; tmpPart->NewPart = false; SnakeParts.push_back(tmpPart); } SnakeDirections[SNAKE_MOVE_UP] = std::make_pair(0, -1); SnakeDirections[SNAKE_MOVE_DOWN] = std::make_pair(0, 1); SnakeDirections[SNAKE_MOVE_LEFT] = std::make_pair(-1, 0); SnakeDirections[SNAKE_MOVE_RIGHT] = std::make_pair(1, 0); UpdateBody(); } SnakeEntity::~SnakeEntity() { } void SnakeEntity::ClearBody() { for (std::vector<std::pair<int, int>>::iterator itr = SnakePartsOld.begin(); itr != SnakePartsOld.end(); ++itr) { (*LevelGrid)[(*itr)] = LEVEL_SEGMENT_BLANK; } SnakePartsOld.clear(); } void SnakeEntity::UpdateBody() { ClearBody(); // Clear the old body and add the new one for (std::vector<SnakePart*>::iterator itr = SnakeParts.begin(); itr != SnakeParts.end(); ++itr) { if (itr == SnakeParts.begin()) // First element should always be a head { (*LevelGrid)[(*itr)->Location] = LEVEL_SEGMENT_PLAYER_SNAKE_HEAD; } else { (*LevelGrid)[(*itr)->Location] = LEVEL_SEGMENT_PLAYER_SNAKE; } } } void SnakeEntity::Move(SnakeMovement _Direction) { for (std::vector<SnakePart*>::iterator itr = SnakeParts.begin(); itr != SnakeParts.end(); ++itr) { SnakePartsOld.push_back((*itr)->Location); } std::pair<int, int> newPosition = std::make_pair(SnakeDirections[_Direction].first + SnakeParts.front()->Location.first, SnakeDirections[_Direction].second + SnakeParts.front()->Location.second); if (!Collision(newPosition)) // Make sure we dont collide with anything { SnakeParts.front()->Location = newPosition; // Update snake head position SnakeMovement parentMovement = SnakeParts.front()->LastMovement; SnakeMovement oldMovement; std::pair<int, int> lastPosition; // Update body for (std::vector<SnakePart*>::iterator itr = SnakeParts.begin(); itr != SnakeParts.end(); ++itr) { if (itr == SnakeParts.begin()) // Ignore head continue; if ((*itr)->NewPart) // Expand snake to add new part { (*itr)->Location = lastPosition; (*itr)->LastMovement = oldMovement; (*itr)->NewPart = false; } else { lastPosition = (*itr)->Location; newPosition = std::make_pair(SnakeDirections[parentMovement].first + (*itr)->Location.first, SnakeDirections[parentMovement].second + (*itr)->Location.second); (*itr)->Location = newPosition; oldMovement = (*itr)->LastMovement; (*itr)->LastMovement = parentMovement; parentMovement = oldMovement; } } SnakeParts.front()->LastMovement = _Direction; } } // Kill the snake void SnakeEntity::Kill() { isDead = true; printf("SNAKE: Snake Died!\n"); } bool SnakeEntity::CanMove(LevelSegment _SegmentType) { switch (_SegmentType) { case LEVEL_SEGMENT_BLANK: case LEVEL_SEGMENT_PLAYER_FOOD: return true; default: case LEVEL_SEGMENT_WALL: case LEVEL_SEGMENT_PLAYER_SNAKE: case LEVEL_SEGMENT_PLAYER_SNAKE_HEAD: // Odd case check would never happen, never hurts to add it though return false; } } bool SnakeEntity::Collision(std::pair<int, int> _Location) { LevelSegment segmentCheck = (*LevelGrid)[_Location]; switch (segmentCheck) { case LEVEL_SEGMENT_PLAYER_FOOD: isFoodCollected = true; break; case LEVEL_SEGMENT_WALL: case LEVEL_SEGMENT_PLAYER_SNAKE: case LEVEL_SEGMENT_PLAYER_SNAKE_HEAD: // Odd case check would never happen, never hurts to add it though Kill(); break; } if (isFoodCollected) // If food is collected increase snake length by 1 { SnakePart* tmpPart = new SnakePart(); tmpPart->NewPart = true; SnakeParts.push_back(tmpPart); } return !CanMove(segmentCheck); } SnakeMovement SnakeEntity::GetOppositeMovement(SnakeMovement _Movement) { switch (_Movement) { case SNAKE_MOVE_UP: return SNAKE_MOVE_DOWN; case SNAKE_MOVE_DOWN: return SNAKE_MOVE_UP; case SNAKE_MOVE_LEFT: return SNAKE_MOVE_RIGHT; default: case SNAKE_MOVE_RIGHT: return SNAKE_MOVE_LEFT; } } // Path Finding Algorithm // A* Path finding algorithm originally from: http://code.activestate.com/recipes/577457-a-star-shortest-path-algorithm/ // TODO: Fix this method, it attempts to collide with it self causing it to die. bool SnakeEntity::CalculatePath(std::pair<int, int> _ToGridReference) { std::priority_queue<PathNode> possibleOpenNodesQueue[2]; int queueIndex = 0; PathNode* gridNode; PathNode* gridChildNode; int gridX, gridY, xDirection, yDirection; std::pair<int, int> gridLocation, gridDirection, startPosition; startPosition = SnakeParts.front()->Location; // Clear any remaining paths from old calculations SnakePath.clear(); // Clear nodes PathClosedNodes.clear(); PathOpenNodes.clear(); gridNode = new PathNode(startPosition, 0, 0); gridNode->UpdatePriority(_ToGridReference); possibleOpenNodesQueue[queueIndex].push(*gridNode); PathOpenNodes[startPosition] = gridNode->Priority; // Mark first point while (!possibleOpenNodesQueue[queueIndex].empty()) { gridNode = new PathNode(possibleOpenNodesQueue[queueIndex].top().Position, possibleOpenNodesQueue[queueIndex].top().Depth, possibleOpenNodesQueue[queueIndex].top().Priority); gridX = gridNode->Position.first; gridY = gridNode->Position.second; gridLocation = std::make_pair(gridX, gridY); possibleOpenNodesQueue[queueIndex].pop(); PathOpenNodes[gridLocation] = 0; PathClosedNodes[gridLocation] = true; if (gridLocation == _ToGridReference) { while (gridLocation != startPosition) { // Fill Snake path SnakeMovement tmpMovement = PathDirections[gridLocation]; gridX += SnakeDirections[tmpMovement].first; gridY += SnakeDirections[tmpMovement].second; gridLocation = std::make_pair(gridX, gridY); SnakePath.push_back(GetOppositeMovement(tmpMovement)); } delete gridNode; // Empty unused nodes while (!possibleOpenNodesQueue[queueIndex].empty()) { possibleOpenNodesQueue[queueIndex].pop(); } printf("SNAKE (FOOD FOUND): X: %i Y: %i\n", gridX, gridY); return true; } for (int i = 0; i < SnakeDirections.size(); i++) { xDirection = gridX + SnakeDirections[(SnakeMovement)i].first; yDirection = gridY + SnakeDirections[(SnakeMovement)i].second; gridDirection = std::make_pair(xDirection, yDirection); // Check to see if snake can move there or that the node isnt closed if (CanMove((*LevelGrid)[gridDirection]) || !PathClosedNodes[gridDirection]) { gridChildNode = new PathNode(gridDirection, gridNode->Depth, gridNode->Priority); gridChildNode->NextDepth((SnakeMovement)i); gridChildNode->UpdatePriority(_ToGridReference); if (PathOpenNodes.count(gridDirection) == 0) { PathOpenNodes[gridDirection] = gridChildNode->Priority; possibleOpenNodesQueue[queueIndex].push(*gridChildNode); PathDirections[gridDirection] = GetOppositeMovement((SnakeMovement)i); } else if (PathOpenNodes[gridDirection] > gridChildNode->Priority) { PathOpenNodes[gridDirection] = gridChildNode->Priority; PathDirections[gridDirection] = GetOppositeMovement((SnakeMovement)i); while (possibleOpenNodesQueue[queueIndex].top().Position != gridDirection) { possibleOpenNodesQueue[1 - queueIndex].push(possibleOpenNodesQueue[queueIndex].top()); possibleOpenNodesQueue[queueIndex].pop(); } possibleOpenNodesQueue[queueIndex].pop(); if (possibleOpenNodesQueue[queueIndex].size() > possibleOpenNodesQueue[1 - queueIndex].size()) { queueIndex = 1 - queueIndex; } while (!possibleOpenNodesQueue[queueIndex].empty()) { possibleOpenNodesQueue[1 - queueIndex].push(possibleOpenNodesQueue[queueIndex].top()); possibleOpenNodesQueue[queueIndex].pop(); } queueIndex = 1 - queueIndex; possibleOpenNodesQueue[queueIndex].push(*gridChildNode); } else { delete gridChildNode; } } } delete gridNode; } return false; } void SnakeEntity::MoveOnPath() { if (!SnakePath.empty() && !isFoodCollected) // Move only if there is a next path { Move(SnakePath.front()); SnakePath.erase(SnakePath.begin()); } else { if (!CalculatePath(std::make_pair(SnakeFoodLocation->first, SnakeFoodLocation->second))) // Calculate route to food { // Cant calculate path, so move to any free space, to see if we can create a path. if (!MoveToFreeSpace()) { // Cant move to free space, so set to dead Kill(); } } } } // Move to any possible free space, this could be improved on. bool SnakeEntity::MoveToFreeSpace() { std::vector<int> movesAvailable; for (std::map<SnakeMovement, std::pair<int, int>>::iterator itr = SnakeDirections.begin(); itr != SnakeDirections.end(); ++itr) movesAvailable.push_back((int)itr->first); while (movesAvailable.size() > 0) { int randomIndex = (rand() % (movesAvailable.size())); SnakeMovement moveDirection = (SnakeMovement)movesAvailable[randomIndex]; movesAvailable.erase(movesAvailable.begin() + randomIndex); std::pair<int, int> newPosition = std::make_pair(SnakeDirections[moveDirection].first + SnakeParts.front()->Location.first, SnakeDirections[moveDirection].second + SnakeParts.front()->Location.second); if (CanMove((*LevelGrid)[newPosition])) { Move((SnakeMovement)moveDirection); return true; } } return false; } void SnakeEntity::Unload() { LevelGrid = nullptr; SnakeParts.clear(); SnakePath.clear(); isDead = false; isFoodCollected = false; } void SnakeEntity::Update(float _DeltaTime) { if (!isDead) // Dont update if dead { // Move the snake on the calculated path, or if no path exists calculate one. MoveOnPath(); // Update snake body to map with new positions UpdateBody(); } }
28.790451
203
0.718261
DanielMcAssey
5b2247bfe72322a1bbce35b4c9d07ef0ca4eb38e
4,255
cpp
C++
Cellular/Cellular/src/Window.cpp
Hukunaa/SandGame
ec33e942d2a377404b09849d09d6997cc13cf879
[ "MIT" ]
null
null
null
Cellular/Cellular/src/Window.cpp
Hukunaa/SandGame
ec33e942d2a377404b09849d09d6997cc13cf879
[ "MIT" ]
null
null
null
Cellular/Cellular/src/Window.cpp
Hukunaa/SandGame
ec33e942d2a377404b09849d09d6997cc13cf879
[ "MIT" ]
null
null
null
#include <Window.h> #include <iostream> std::mutex Window::mtx; Window::Window() { } Window::Window(int x, int y, std::string name) { window = new sf::RenderWindow(sf::VideoMode(x, y), name); collisionCheck = new ArrData[40000]; for (int i = 0; i < 40000; ++i) collisionCheck[i].part = nullptr; if (!m_font.loadFromFile("include/Minecraft.ttf")) std::cout << "CAN'T LOAD FONT FILE!\n"; m_text.setFont(m_font); m_fps.setFont(m_font); particles.reserve(50000); canDraw.store(false); isDrawing.store(false); Game::SetWindow(window); Game::InitPhysicsThread(collisionCheck, particles, this); particle_buffer1 = sf::VertexArray(sf::Quads); RenderingThread = std::thread(&Window::Render, std::ref(particles), std::ref(particle_buffer1), 1, std::ref(canDraw), std::ref(isDrawing)); RenderingThread.detach(); /*ArrayUpdater = std::thread(&Window::UpdateArrays, collisionCheck, std::ref(particles)); ArrayUpdater.detach();*/ } Window::~Window() { delete window; } void Window::Update() { sf::Clock time; float oldTime = 0; float newTime = 0; float DeltaTime = 0; float tmpTime = 0; m_text.setCharacterSize(14); m_fps.setCharacterSize(14); m_fps.setPosition(sf::Vector2f(0, 15)); while (window->isOpen()) { oldTime = newTime; newTime = time.getElapsedTime().asMicroseconds(); CheckEvents(); std::string text = std::to_string(particles.size()); m_text.setString(text); if (time.getElapsedTime().asMilliseconds() > tmpTime) { m_fps.setString(std::to_string(DeltaTime)); tmpTime = time.getElapsedTime().asMilliseconds() + 100; } if (particle_buffer1.getVertexCount() > 3 && canDraw.load()) { isDrawing.store(true); window->clear(); window->draw(m_text); window->draw(m_fps); window->draw(particle_buffer1); isDrawing.store(false); } window->display(); DeltaTime = 1 / ((newTime - oldTime) / 1000000); } } void Window::CheckEvents() { sf::Event event; while (window->pollEvent(event)) { if (event.type == sf::Event::Closed) window->close(); } } void Window::Render(std::vector<Particle*>& allParticles, sf::VertexArray& particle_buffer, int threadNb, std::atomic_bool& canDraw, std::atomic_bool& isDrawing) { while (true) { if (!isDrawing.load()) { canDraw.store(false); particle_buffer.clear(); for (Particle* particle : allParticles) { //particle->mtx.lock(); int screenPos = particle->screenGridPos; Vector2 roundedPos = Vector2::roundVector(particle->m_pos, 4); //particle->mtx.unlock(); sf::Vector2f partPos(roundedPos.x, roundedPos.y); particle_buffer.append(sf::Vertex(sf::Vector2f(partPos.x, partPos.y), sf::Color::Magenta)); particle_buffer.append(sf::Vertex(sf::Vector2f(partPos.x + 4, partPos.y), sf::Color::Cyan)); particle_buffer.append(sf::Vertex(sf::Vector2f(partPos.x + 4, partPos.y + 4), sf::Color::Cyan)); particle_buffer.append(sf::Vertex(sf::Vector2f(partPos.x, partPos.y + 4), sf::Color::Magenta)); } canDraw.store(true); } //Clamp de thread refresh rate by 144FPS, avoinding the thread to use all the CPU Power trying to refresh the buffer an insane amount of times per frame std::this_thread::sleep_for(std::chrono::microseconds(6900)); } } void Window::UpdateArrays(ArrData* arr, std::vector<Particle*>& particles) { for (int i = 0; i < 40000; ++i) arr[i].part = nullptr; for (Particle* particle : particles) { Vector2 pos = Vector2::roundVector(particle->m_pos, 4); int posX = pos.x / 4; int posY = pos.y / 4; //arr[posY * 200 + posX].mtx.lock(); arr[posY * 200 + posX].part = particle; //arr[posY * 200 + posX].mtx.unlock(); //std::cout << "Col pos:" << posX << " / " << posY << "\n"; } }
30.177305
161
0.587544
Hukunaa
5b350088139791ab79c3469873954b19e485c0d7
1,482
hpp
C++
pybind/handler.hpp
mnaza/Pangolin
2ed3f08f9ccb82255d23c6db1dce426166ceb3bf
[ "MIT" ]
1
2018-01-14T08:44:02.000Z
2018-01-14T08:44:02.000Z
pybind/handler.hpp
mnaza/Pangolin
2ed3f08f9ccb82255d23c6db1dce426166ceb3bf
[ "MIT" ]
null
null
null
pybind/handler.hpp
mnaza/Pangolin
2ed3f08f9ccb82255d23c6db1dce426166ceb3bf
[ "MIT" ]
null
null
null
// // Copyright (c) Andrey Mnatsakanov // #ifndef PY_PANGOLIN_HANDLER_HPP #define PY_PANGOLIN_HANDLER_HPP #include <pybind11/pybind11.h> #include <pangolin/handler/handler.h> #include <pangolin/display/view.h> namespace py_pangolin { class PyHandler : public pangolin::Handler { public: using pangolin::Handler::Handler; void Keyboard(pangolin::View& v, unsigned char key, int x, int y, bool pressed) override { PYBIND11_OVERLOAD(void, pangolin::Handler, Keyboard, v, key, x, y, pressed); } void Mouse(pangolin::View& v, pangolin::MouseButton button, int x, int y, bool pressed, int button_state) override { PYBIND11_OVERLOAD(void, pangolin::Handler, Mouse, v, button, x, y, pressed, button_state); } void MouseMotion(pangolin::View& v, int x, int y, int button_state) override { PYBIND11_OVERLOAD(void, pangolin::Handler, MouseMotion, v, x, y, button_state); } void PassiveMouseMotion(pangolin::View& v, int x, int y, int button_state) override { PYBIND11_OVERLOAD(void, pangolin::Handler, PassiveMouseMotion, v, x, y, button_state); } void Special(pangolin::View& v, pangolin::InputSpecial inType, float x, float y, float p1, float p2, float p3, float p4, int button_state) override{ PYBIND11_OVERLOAD(void, pangolin::Handler, Special, v, inType, x, y, p1, p2, p3, p4, button_state); } }; void bind_handler(pybind11::module &m); } // py_pangolin #endif //PY_PANGOLIN_HANDLER_HPP
35.285714
152
0.706478
mnaza
5b3dc38e0fd3189a12e0dd0761c6f19f6df170e9
320
hpp
C++
domain/params/inc/i_hit_params.hpp
PKizin/game_design
6223466ea46c091616f8d832659306fe7140b316
[ "MIT" ]
null
null
null
domain/params/inc/i_hit_params.hpp
PKizin/game_design
6223466ea46c091616f8d832659306fe7140b316
[ "MIT" ]
null
null
null
domain/params/inc/i_hit_params.hpp
PKizin/game_design
6223466ea46c091616f8d832659306fe7140b316
[ "MIT" ]
null
null
null
#ifndef I_HIT_PARAMS_HPP #define I_HIT_PARAMS_HPP #include "e_params_categories.hpp" class IHitParams { public: virtual float get_hit_param(EHitParams) const = 0; virtual void set_hit_param(EHitParams, float) = 0; protected: IHitParams() { } virtual ~IHitParams() { } }; #endif // I_HIT_PARAMS_HPP
16.842105
54
0.725
PKizin
5b3f2bc436fcaf9a49307a565a1bbe07f5440df3
2,740
cpp
C++
numeric.cpp
SimplyCpp/exemplos
139cd3c7af6885d0f4be45b0049e0f714bce3468
[ "MIT" ]
6
2015-05-19T06:30:06.000Z
2018-07-24T08:15:45.000Z
numeric.cpp
SimplyCpp/exemplos
139cd3c7af6885d0f4be45b0049e0f714bce3468
[ "MIT" ]
1
2015-05-19T06:42:38.000Z
2015-05-19T14:45:49.000Z
numeric.cpp
SimplyCpp/exemplos
139cd3c7af6885d0f4be45b0049e0f714bce3468
[ "MIT" ]
3
2015-10-09T05:54:58.000Z
2018-07-25T13:52:32.000Z
//Sample provided by Thiago Massari Guedes //December 2015 //http://www.simplycpp.com/ #include <algorithm> #include <iostream> #include <iterator> #include <string> namespace concrete { //C++98 version ---------------------------- struct numerical_appender { numerical_appender(std::string &buf) : _buf(buf) { } void operator()(const char c) { if( c >= '0' && c <= '9' ) _buf.push_back(c); } private: std::string &_buf; }; void get_numeric(const std::string &input, std::string &output) { numerical_appender appender(output); std::for_each(input.begin(), input.end(), appender); } //C++14 version ---------------------------- std::string get_numeric(const std::string &input) { std::string output; std::for_each(begin(input), end(input), [&output](const char c) { if( c >= '0' && c <= '9' ) output.push_back(c); }); return output; } } namespace generic { //Generic version - C++98 ------------------ template<class OutputIterator, class ValueType> struct numerical_appender { numerical_appender(OutputIterator it) : _it(it) { } void operator()(const ValueType c) { if( c >= '0' && c <= '9' ) { *_it = c; _it++; } } private: OutputIterator _it; }; template<class T> void get_numeric(const T &input, T &output) { typedef std::back_insert_iterator<T> it_type; it_type it = std::back_inserter(output); numerical_appender<it_type, typename T::value_type> appender(it); std::for_each(input.begin(), input.end(), appender); } //Generic version - C++14 ------------------ template<typename T> T get_numeric(const T &input) { T output; std::for_each(begin(input), end(input), [&output](auto c) { if( c >= '0' && c <= '9' ) output.push_back(c); }); return output; } } namespace with_stl { template<typename T> T get_numeric(const T &input) { T output; std::copy_if(begin(input), end(input), std::back_inserter(output), [](auto c) { if( c >= '0' && c <= '9' ) return true; return false; }); return output; } } int main() { //C++98 version std::string value = "12asew3d45ddf678ee9 0"; std::string num; concrete::get_numeric(value, num); std::cout << value << " - " << num << std::endl; num.clear(); generic::get_numeric(value, num); std::cout << value << " - " << num << std::endl; //C++14 version std::cout << value << " - " << concrete::get_numeric(value) << std::endl; std::cout << value << " - " << generic::get_numeric(value) << std::endl; std::cout << value << " - " << with_stl::get_numeric(value) << std::endl; std::vector<char> v_in {'1', 'a', '2', 'b', 'c', '3'}; decltype(v_in) v_out = generic::get_numeric(v_in); for(auto &i : v_out) { std::cout << i << " "; } std::cout << std::endl; }
24.464286
81
0.599635
SimplyCpp
5b44ad8774a4a352a2fcbc42422aa966a945acd3
967
hpp
C++
SDK/ARKSurvivalEvolved_LeftClimbing_ImpactEffect_Metal_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
10
2020-02-17T19:08:46.000Z
2021-07-31T11:07:19.000Z
SDK/ARKSurvivalEvolved_LeftClimbing_ImpactEffect_Metal_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
9
2020-02-17T18:15:41.000Z
2021-06-06T19:17:34.000Z
SDK/ARKSurvivalEvolved_LeftClimbing_ImpactEffect_Metal_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
3
2020-07-22T17:42:07.000Z
2021-06-19T17:16:13.000Z
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_LeftClimbing_ImpactEffect_Metal_classes.hpp" namespace sdk { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function LeftClimbing_ImpactEffect_Metal.LeftClimbing_ImpactEffect_Metal_C.UserConstructionScript struct ALeftClimbing_ImpactEffect_Metal_C_UserConstructionScript_Params { }; // Function LeftClimbing_ImpactEffect_Metal.LeftClimbing_ImpactEffect_Metal_C.ExecuteUbergraph_LeftClimbing_ImpactEffect_Metal struct ALeftClimbing_ImpactEffect_Metal_C_ExecuteUbergraph_LeftClimbing_ImpactEffect_Metal_Params { int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
29.30303
152
0.638056
2bite
5b460f288b981de7fde05ad02c8dee3c9f2ec179
1,090
cpp
C++
examples/toml_to_json_transcoder.cpp
GiulioRomualdi/tomlplusplus
3f04e12b53f6fca1c12f230d285da167a656c899
[ "MIT" ]
null
null
null
examples/toml_to_json_transcoder.cpp
GiulioRomualdi/tomlplusplus
3f04e12b53f6fca1c12f230d285da167a656c899
[ "MIT" ]
null
null
null
examples/toml_to_json_transcoder.cpp
GiulioRomualdi/tomlplusplus
3f04e12b53f6fca1c12f230d285da167a656c899
[ "MIT" ]
null
null
null
#include <iostream> #include <fstream> #include <toml++/toml.h> #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include <Windows.h> #endif using namespace std::string_view_literals; int main(int argc, char** argv) { #ifdef _WIN32 SetConsoleOutputCP(65001); //UTF-8 console output #endif //read from a file if (argc > 1) { auto path = std::string{ argv[1] }; auto file = std::ifstream{ path }; if (!file) { std::cerr << "The file '"sv << path << "' could not be opened for reading."sv << std::endl; return -1; } try { const auto table = toml::parse(file, std::move(path)); std::cout << toml::json_formatter{ table } << std::endl; } catch (const toml::parse_error& err) { std::cerr << "Error parsing file:\n"sv << err << std::endl; return 1; } } //read directly from stdin else { try { const auto table = toml::parse(std::cin); std::cout << toml::json_formatter{ table } << std::endl; } catch (const toml::parse_error& err) { std::cerr << "Error parsing stdin:\n"sv << err << std::endl; return 1; } } return 0; }
18.793103
94
0.615596
GiulioRomualdi
5b4778588cf91e7a561ea17e1f690d1383179466
19,994
cpp
C++
time_util.cpp
r3dl3g/util
385fd89d2d453d8827e3b92187b4087744b3d8c4
[ "MIT" ]
null
null
null
time_util.cpp
r3dl3g/util
385fd89d2d453d8827e3b92187b4087744b3d8c4
[ "MIT" ]
null
null
null
time_util.cpp
r3dl3g/util
385fd89d2d453d8827e3b92187b4087744b3d8c4
[ "MIT" ]
null
null
null
/** * @copyright (c) 2015-2021 Ing. Buero Rothfuss * Riedlinger Str. 8 * 70327 Stuttgart * Germany * http://www.rothfuss-web.de * * @author <a href="mailto:[email protected]">Armin Rothfuss</a> * * Project utility lib * * @brief C++ API: time utilities * * @license MIT license. See accompanying file LICENSE. */ // -------------------------------------------------------------------------- // // Common includes // #include <iomanip> // -------------------------------------------------------------------------- // // Library includes // #include "time_util.h" #include "string_util.h" #include "ostream_resetter.h" /** * Provides an API to stream into OutputDebugString. */ namespace util { namespace time { // -------------------------------------------------------------------------- std::tm mktm (int year, int month, int day, int hour, int minute, int second, int isdst) { return std::tm{ second, minute, hour, day, tm_mon(month), tm_year(year), 0, 0, isdst }; } // -------------------------------------------------------------------------- std::tm time_t2tm (const std::time_t now) { std::tm t{}; #ifdef WIN32 localtime_s(&t, &now); #else localtime_r(&now, &t); #endif return t; } // -------------------------------------------------------------------------- std::tm time_t2utc (const std::time_t now) { std::tm t{}; #ifdef WIN32 gmtime_s(&t, &now); #else gmtime_r(&now, &t); #endif return t; } // -------------------------------------------------------------------------- time_point time_t2time_point (std::time_t t) { return std::chrono::system_clock::from_time_t(t); } std::time_t time_point2time_t (time_point tp) { return std::chrono::system_clock::to_time_t(tp); } // -------------------------------------------------------------------------- std::time_t get_local_time_offset () { static std::time_t offset = [] () { std::tm t_ = mktm(2000, 1, 1, 0, 0, 0, 0); const auto t = std::mktime(&t_); std::tm tl_ = time_t2tm(t); const auto tl = std::mktime(&tl_); std::tm tu_ = time_t2utc(t); const auto tu = std::mktime(&tu_); return (tl - tu); } (); return offset; } // -------------------------------------------------------------------------- std::time_t tm2time_t (const std::tm& t_) { std::tm t = t_; return std::mktime(&t); } std::time_t tm2time_t (std::tm&& t) { return std::mktime(&t); } time_point mktime_point (int year, int month, int day, int hour, int minute, int second, int millis, int isdst) { return std::chrono::system_clock::from_time_t(tm2time_t(mktm(year, month, day, hour, minute, second, isdst))) + std::chrono::milliseconds(millis); } // -------------------------------------------------------------------------- std::tm local_time (time_point const& tp) { return time_t2tm(std::chrono::system_clock::to_time_t(tp)); } std::tm local_time_now () { return local_time(std::chrono::system_clock::now()); } // -------------------------------------------------------------------------- std::time_t utc2time_t (const std::tm& t) { return tm2time_t(t) + get_local_time_offset(); } std::time_t utc2time_t (std::tm&& t) { return tm2time_t(std::move(t)) + get_local_time_offset(); } time_point mktime_point_from_utc (int year, int month, int day, int hour, int minute, int second, int millis) { return std::chrono::system_clock::from_time_t(utc2time_t(mktm(year, month, day, hour, minute, second, 0))) + std::chrono::milliseconds(millis); } std::tm utc_time (time_point const& tp) { return time_t2utc(std::chrono::system_clock::to_time_t(tp)); } std::tm utc_time_now () { return utc_time(std::chrono::system_clock::now()); } // -------------------------------------------------------------------------- UTIL_EXPORT int week_of_year (const std::tm& t) { return ((t.tm_yday + 7 - weekday_of(t)) / 7); } // -------------------------------------------------------------------------- UTIL_EXPORT std::time_t first_day_of_week (int year, int w) { const int yday = w * 7; const auto t = tm2time_t(mktm(year, 1, yday)); const auto tm = time_t2tm(t); const auto wd = weekday_of(tm); if (wd == 0) { // already monday return t; } return tm2time_t(mktm(year_of(tm), 1, tm.tm_yday - wd + 1)); } // -------------------------------------------------------------------------- UTIL_EXPORT std::ostream& format_datetime (std::ostream& out, const std::tm& t, const char* date_delem, const char* separator, const char* time_delem) { format_date(out, t, date_delem); out << separator; format_time(out, t, time_delem); return out; } std::string format_datetime (const std::tm& t, const char* date_delem, const char* separator, const char* time_delem) { std::ostringstream os; format_datetime(os, t, date_delem, separator, time_delem); return os.str(); } // -------------------------------------------------------------------------- UTIL_EXPORT std::ostream& format_datetime (std::ostream& out, const std::time_t& tp, const char* date_delem, const char* separator, const char* time_delem) { return format_datetime(out, time_t2tm(tp), date_delem, separator, time_delem); } std::string format_datetime (const std::time_t& tp, const char* date_delem, const char* separator, const char* time_delem) { std::ostringstream os; format_datetime(os, tp, date_delem, separator, time_delem); return os.str(); } // -------------------------------------------------------------------------- UTIL_EXPORT std::ostream& format_datetime (std::ostream& out, time_point const& tp, const char* date_delem, const char* separator, const char* time_delem, bool add_micros) { format_datetime(out, time_t2tm(std::chrono::system_clock::to_time_t(tp)), date_delem, separator, time_delem); if (add_micros) { auto t0 = std::chrono::time_point_cast<std::chrono::seconds>(tp); auto micros = std::chrono::duration_cast<std::chrono::microseconds>(tp - t0); ostream_resetter r(out); out << '.' << std::setfill('0') << std::setw(6) << micros.count(); } return out; } std::string format_datetime (time_point const& tp, const char* date_delem, const char* separator, const char* time_delem, bool add_micros) { std::ostringstream os; format_datetime(os, tp, date_delem, separator, time_delem, add_micros); return os.str(); } // -------------------------------------------------------------------------- #if (USE_FILE_TIME_POINT) std::string format_datetime (file_time_point const& ftp, const char* date_delem, const char* separator, const char* time_delem, bool add_micros) { #if WIN32 # if defined USE_MINGW using namespace std::chrono; auto sctp = time_point_cast<system_clock::duration>(ftp - file_time_point::clock::now() + system_clock::now()); const auto tse = system_clock::to_time_t(sctp); const time_point tp = time_point(time_point::duration(tse)); # elif _MSC_VER < 1917 const auto tse = ftp.time_since_epoch().count() - __std_fs_file_time_epoch_adjustment; const time_point tp = time_point(time_point::duration(tse)); # else const auto tse = ftp.time_since_epoch().count() - std::filesystem::__std_fs_file_time_epoch_adjustment; const time_point tp = time_point(time_point::duration(tse)); # endif #elif __cplusplus > 201703L // C++20 const auto systemTime = std::chrono::clock_cast<std::chrono::system_clock>(ftp); const time_point tp = std::chrono::system_clock::to_time_t(systemTime); #elif __cplusplus < 201401L // this is gcc 5.1 or pior std::time_t tt = file_time_point::clock::to_time_t(ftp); const auto tp = std::chrono::system_clock::from_time_t(tt); #else using namespace std::chrono; const time_point tp = time_point_cast<system_clock::duration>(ftp - file_time_point::clock::now() + system_clock::now()); #endif return format_datetime(tp, date_delem, separator, time_delem, add_micros); } #endif bool skip_delemiter (std::istream& is) { char ch = is.peek(); while (is.good() && (('.' == ch) || (':' == ch) || ('-' == ch) || (' ' == ch) || ('\\' == ch) || ('T' == ch))) { is.ignore(); ch = is.peek(); } return is.good() && ('\n' != ch) && ('\r' != ch); } time_point parse_datetime (const std::string& s) { std::istringstream is(s); return parse_datetime(is); } time_point parse_datetime (std::istream& is) { int year = 0, month = 1, day = 1, hour = 0, minute = 0, second = 0, millis = 0; if (skip_delemiter(is)) { is >> year; if (skip_delemiter(is)) { is >> month; if (skip_delemiter(is)) { is >> day; if (skip_delemiter(is)) { is >> hour; if (skip_delemiter(is)) { is >> minute; if (skip_delemiter(is)) { is >> second; if (is.good() && (is.peek() == '.')) { if (skip_delemiter(is)) { is >> millis; } } } } } } } } return mktime_point(year, month, day, hour, minute, second, millis); } // -------------------------------------------------------------------------- UTIL_EXPORT std::ostream& format_time (std::ostream& out, const std::tm& t, const char* delem) { ostream_resetter r(out); out << std::setfill('0') << std::setw(2) << t.tm_hour << delem << std::setw(2) << t.tm_min << delem << std::setw(2) << t.tm_sec; return out; } UTIL_EXPORT std::string format_time (const std::tm& t, const char* delem) { std::ostringstream is; format_time(is, t, delem); return is.str(); } // -------------------------------------------------------------------------- UTIL_EXPORT std::ostream& format_date (std::ostream& out, const std::tm& t, const char* delem) { ostream_resetter r(out); out << std::setfill('0') << year_of(t) << delem << std::setw(2) << month_of(t) << delem << std::setw(2) << day_of(t); return out; } UTIL_EXPORT std::ostream& format_date (std::ostream& out, const std::time_t& tp, const char* delem) { return format_date(out, time_t2tm(tp), delem); } UTIL_EXPORT std::ostream& format_date (std::ostream& out, time_point const& tp, const char* delem) { return format_date(out, std::chrono::system_clock::to_time_t(tp), delem); } // -------------------------------------------------------------------------- UTIL_EXPORT time_point parse_date (std::istream& is) { int year = 0, month = 1, day = 1; if (skip_delemiter(is)) { is >> year; if (skip_delemiter(is)) { is >> month; if (skip_delemiter(is)) { is >> day; } } } return mktime_point(year, month, day); } UTIL_EXPORT time_point parse_date (const std::string& s) { std::istringstream is(s); return parse_date(is); } // -------------------------------------------------------------------------- duration mkduration (int hours, int mins, int secs, int mcrsecs) { return std::chrono::hours(hours) + std::chrono::minutes(mins) + std::chrono::seconds(secs) + std::chrono::microseconds(mcrsecs); } // -------------------------------------------------------------------------- duration_parts duration2parts (duration const& d) { using namespace std::chrono; const auto hrs = duration_cast<hours>(d); const auto mins = duration_cast<minutes>(d - hrs); const auto secs = duration_cast<seconds>(d - hrs - mins); const auto ms = duration_cast<microseconds>(d - hrs - mins - secs); return { static_cast<int>(hrs.count()), static_cast<int>(mins.count()), static_cast<int>(secs.count()), static_cast<int>(ms.count()) }; } duration parts2duration (const duration_parts& p) { using namespace std::chrono; return hours(p.hours) + minutes(p.mins) + seconds(p.secs) + microseconds(p.micros); } // -------------------------------------------------------------------------- std::ostream& format_duration_mt (std::ostream& out, duration const& d, int hours_per_mt, const char* separator, const char* time_delem, bool add_micros, bool minimize) { ostream_resetter r(out); duration_parts p = duration2parts(d); auto days = p.hours / hours_per_mt; p.hours %= hours_per_mt; bool has_prefix = !minimize; if (days || has_prefix) { out << days << separator; has_prefix = true; } out << std::setfill('0'); if (p.hours || has_prefix) { out << std::setw(2) << p.hours << time_delem; has_prefix = true; } if (p.mins || has_prefix) { out << std::setw(2) << p.mins << time_delem; has_prefix = true; } if (has_prefix) { out << std::setw(2); } out << p.secs; if (add_micros) { out << '.' << std::setfill('0') << std::setw(6) << p.micros; } return out; } // -------------------------------------------------------------------------- std::ostream& format_duration_only_h (std::ostream& out, duration const& d, const char* time_delem, bool add_micros, bool minimize) { ostream_resetter r(out); duration_parts p = duration2parts(d); out << std::setfill('0'); bool has_prefix = !minimize; if (p.hours || has_prefix) { out << std::setw(2) << p.hours << time_delem; has_prefix = true; } if (p.mins || has_prefix) { out << std::setw(2) << p.mins << time_delem; has_prefix = true; } if (has_prefix) { out << std::setw(2); } out << p.secs; if (add_micros) { out << '.' << std::setfill('0') << std::setw(6) << p.micros; } return out; } // -------------------------------------------------------------------------- std::ostream& format_duration (std::ostream& out, duration const& d, const char* separator, const char* time_delem, bool add_micros, bool minimize) { return format_duration_mt(out, d, 24, separator, time_delem, add_micros, minimize); } // -------------------------------------------------------------------------- std::string format_duration (duration const& d, const char* separator, const char* time_delem, bool add_micros, bool minimize) { std::ostringstream os; format_duration(os, d, separator, time_delem, add_micros, minimize); return os.str(); } // -------------------------------------------------------------------------- std::string format_duration_mt (duration const& d, int hours_per_mt, const char* separator, const char* time_delem, bool add_micros, bool minimize) { std::ostringstream os; format_duration_mt(os, d, hours_per_mt, separator, time_delem, add_micros, minimize); return os.str(); } // -------------------------------------------------------------------------- std::string format_duration_only_h (duration const& d, const char* time_delem, bool add_micros, bool minimize) { std::ostringstream os; format_duration_only_h(os, d, time_delem, add_micros, minimize); return os.str(); } // -------------------------------------------------------------------------- duration parse_duration (const std::string& s) { std::istringstream is(s); return parse_duration(is); } duration parse_duration (std::istream& is) { int day = 0, hour = 0, minute = 0, second = 0, millis = 0; if (skip_delemiter(is)) { is >> day; if (skip_delemiter(is)) { is >> hour; if (skip_delemiter(is)) { is >> minute; if (skip_delemiter(is)) { is >> second; if (is.good() && (is.peek() == '.')) { if (skip_delemiter(is)) { is >> millis; } } } } } } return std::chrono::milliseconds(((((((day * 24) + hour) * 60) + minute) * 60) + second) * 1000 + millis); } } // namespace time } // namespace util namespace std { ostream& operator<< (ostream& out, util::time::time_point const& tp) { return util::time::format_datetime(out, tp); } istream& operator>> (istream& in, util::time::time_point& tp) { tp = util::time::parse_datetime(in); return in; } ostream& operator<< (ostream& out, util::time::duration const& d) { return util::time::format_duration(out, d, " ", ":", true); } istream& operator>> (istream& in, util::time::duration& d) { d = util::time::parse_duration(in); return in; } } // namespace std
36.025225
134
0.449485
r3dl3g
5b4981befd71c99fe04ba5e3c15d7dbce7632867
813
cpp
C++
tutorial/classes/Person.cpp
epg-apg/cpptutorial
028e5039314ccd98146d6f394981f137c5b85b19
[ "Unlicense" ]
null
null
null
tutorial/classes/Person.cpp
epg-apg/cpptutorial
028e5039314ccd98146d6f394981f137c5b85b19
[ "Unlicense" ]
null
null
null
tutorial/classes/Person.cpp
epg-apg/cpptutorial
028e5039314ccd98146d6f394981f137c5b85b19
[ "Unlicense" ]
null
null
null
#include <iostream> #include <sstream> #include "Person.h" Person::Person() { std::cout << "Person created..." << std::endl; name = "George"; age = 0; } Person::Person(std::string newName) { name = newName; age = 0; } Person::Person(std::string newName, int newAge) { name = newName; age = newAge; } Person::Person(int age) { this->age = age; } Person::~Person() { std::cout << "Person destroyed..." << std::endl; } void Person::outputMemoryAddress() { std::cout << "Memory: " << this << std::endl; } std::string Person::toString() { std::stringstream temp; temp << "My name is " << name << ". Age: " << age; return temp.str(); } void Person::setName(std::string newName) { name = newName; } std::string Person::getName() { return name; }
14.517857
54
0.579336
epg-apg
5b49b5a5e1d7e5ce8c957f6cf2440b3acbdbd91d
6,924
cpp
C++
leetcode/30_days_challenge/2021_3_March/20.cpp
bvbasavaraju/competitive_programming
a82ffc1b639588a84f4273b44285d57cdc2f4b11
[ "Apache-2.0" ]
1
2020-05-05T13:06:51.000Z
2020-05-05T13:06:51.000Z
leetcode/30_days_challenge/2021_3_March/20.cpp
bvbasavaraju/competitive_programming
a82ffc1b639588a84f4273b44285d57cdc2f4b11
[ "Apache-2.0" ]
null
null
null
leetcode/30_days_challenge/2021_3_March/20.cpp
bvbasavaraju/competitive_programming
a82ffc1b639588a84f4273b44285d57cdc2f4b11
[ "Apache-2.0" ]
null
null
null
/**************************************************** Date: March 20th link: https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/590/week-3-march-15th-march-21st/3673/ ****************************************************/ #include <iostream> #include <vector> #include <list> #include <algorithm> #include <string> #include <stack> #include <queue> #include <map> #include <unordered_map> #include <unordered_set> #include <cmath> #include <limits.h> using namespace std; /* Q Design Underground System Implement the UndergroundSystem class: + void checkIn(int id, string stationName, int t) - A customer with a card id equal to id, gets in the station stationName at time t. - A customer can only be checked into one place at a time. + void checkOut(int id, string stationName, int t) - A customer with a card id equal to id, gets out from the station stationName at time t. - double getAverageTime(string startStation, string endStation) + Returns the average time to travel between the startStation and the endStation. - The average time is computed from all the previous traveling from startStation to endStation that happened directly. - Call to getAverageTime is always valid. You can assume all calls to checkIn and checkOut methods are consistent. If a customer gets in at time t1 at some station, they get out at time t2 with t2 > t1. All events happen in chronological order. Example 1: Input ["UndergroundSystem","checkIn","checkIn","checkIn","checkOut","checkOut","checkOut","getAverageTime","getAverageTime","checkIn","getAverageTime","checkOut","getAverageTime"] [[],[45,"Leyton",3],[32,"Paradise",8],[27,"Leyton",10],[45,"Waterloo",15],[27,"Waterloo",20],[32,"Cambridge",22],["Paradise","Cambridge"],["Leyton","Waterloo"],[10,"Leyton",24],["Leyton","Waterloo"],[10,"Waterloo",38],["Leyton","Waterloo"]] Output [null,null,null,null,null,null,null,14.00000,11.00000,null,11.00000,null,12.00000] Explanation UndergroundSystem undergroundSystem = new UndergroundSystem(); undergroundSystem.checkIn(45, "Leyton", 3); undergroundSystem.checkIn(32, "Paradise", 8); undergroundSystem.checkIn(27, "Leyton", 10); undergroundSystem.checkOut(45, "Waterloo", 15); undergroundSystem.checkOut(27, "Waterloo", 20); undergroundSystem.checkOut(32, "Cambridge", 22); undergroundSystem.getAverageTime("Paradise", "Cambridge"); // return 14.00000. There was only one travel from "Paradise" (at time 8) to "Cambridge" (at time 22) undergroundSystem.getAverageTime("Leyton", "Waterloo"); // return 11.00000. There were two travels from "Leyton" to "Waterloo", a customer with id=45 from time=3 to time=15 and a customer with id=27 from time=10 to time=20. So the average time is ( (15-3) + (20-10) ) / 2 = 11.00000 undergroundSystem.checkIn(10, "Leyton", 24); undergroundSystem.getAverageTime("Leyton", "Waterloo"); // return 11.00000 undergroundSystem.checkOut(10, "Waterloo", 38); undergroundSystem.getAverageTime("Leyton", "Waterloo"); // return 12.00000 Example 2: Input ["UndergroundSystem","checkIn","checkOut","getAverageTime","checkIn","checkOut","getAverageTime","checkIn","checkOut","getAverageTime"] [[],[10,"Leyton",3],[10,"Paradise",8],["Leyton","Paradise"],[5,"Leyton",10],[5,"Paradise",16],["Leyton","Paradise"],[2,"Leyton",21],[2,"Paradise",30],["Leyton","Paradise"]] Output [null,null,null,5.00000,null,null,5.50000,null,null,6.66667] Explanation UndergroundSystem undergroundSystem = new UndergroundSystem(); undergroundSystem.checkIn(10, "Leyton", 3); undergroundSystem.checkOut(10, "Paradise", 8); undergroundSystem.getAverageTime("Leyton", "Paradise"); // return 5.00000 undergroundSystem.checkIn(5, "Leyton", 10); undergroundSystem.checkOut(5, "Paradise", 16); undergroundSystem.getAverageTime("Leyton", "Paradise"); // return 5.50000 undergroundSystem.checkIn(2, "Leyton", 21); undergroundSystem.checkOut(2, "Paradise", 30); undergroundSystem.getAverageTime("Leyton", "Paradise"); // return 6.66667 Constraints: There will be at most 20000 operations. 1 <= id, t <= 106 All strings consist of uppercase and lowercase English letters, and digits. 1 <= stationName.length <= 10 Answers within 10-5 of the actual value will be accepted as correct. Hide Hint #1 Use two hash tables. The first to save the check-in time for a customer and the second to update the total time between two stations. */ //Faster solution!! always use reference!! class UndergroundSystem { private: unordered_map<int, std::pair<string, int> > idStationMap; unordered_map<string, unordered_map<string, vector<double> > > data; public: UndergroundSystem() { } void checkIn(int id, string stationName, int t) { idStationMap[id] = std::make_pair(stationName, t); } void checkOut(int id, string stationName, int t) { std::pair<string, int>& startData = idStationMap[id]; if(data[startData.first][stationName].empty()) { data[startData.first][stationName] = {(t - startData.second) * 1.0, 1.0}; } else { vector<double>& timeData = data[startData.first][stationName]; timeData[0] += (t - startData.second) * 1.0; timeData[1]++; } } double getAverageTime(string startStation, string endStation) { vector<double>& timeData = data[startStation][endStation]; double ans = ((timeData[0] / timeData[1]) * 100000 ) / 100000; return ans; } }; // class UndergroundSystem // { // private: // unordered_map<int, std::pair<string, int> > idStationMap; // map<string, map<string, vector<int> > > data; // public: // UndergroundSystem() // { // } // void checkIn(int id, string stationName, int t) // { // idStationMap[id] = std::make_pair(stationName, t); // } // void checkOut(int id, string stationName, int t) // { // std::pair<string, int> startData = idStationMap[id]; // data[startData.first][stationName].push_back(t - startData.second); // } // double getAverageTime(string startStation, string endStation) // { // map<string, vector<int> > data_ = data[startStation]; // vector<int>& time = data_[endStation]; // double sum = 0.0; // for(int t : time) // { // sum += (t * 1.0); // } // double ans = ((sum / time.size()) * 100000 ) / 100000; // return ans; // } // }; /** * Your UndergroundSystem object will be instantiated and called as such: * UndergroundSystem* obj = new UndergroundSystem(); * obj->checkIn(id,stationName,t); * obj->checkOut(id,stationName,t); * double param_3 = obj->getAverageTime(startStation,endStation); */
38.043956
297
0.659301
bvbasavaraju
5b4b25e02378196ea5acb2abc84e6090787d1267
389
cpp
C++
4th semester/lab_6/src/Sofa.cpp
kmalski/cpp_labs
52b0fc84319d6cc57ff7bfdb787aa5eb09edf592
[ "MIT" ]
1
2020-05-19T17:14:55.000Z
2020-05-19T17:14:55.000Z
4th semester/lab_6/src/Sofa.cpp
kmalski/CPP_Laboratories
52b0fc84319d6cc57ff7bfdb787aa5eb09edf592
[ "MIT" ]
null
null
null
4th semester/lab_6/src/Sofa.cpp
kmalski/CPP_Laboratories
52b0fc84319d6cc57ff7bfdb787aa5eb09edf592
[ "MIT" ]
null
null
null
#include "Sofa.h" #include <iostream> Sofa::Sofa(const int width, const int height, const int length, const int seat) : Mebel(width, height, length), _seat(seat) {} Sofa::Sofa(const int seat) : _seat(seat) {} Sofa::~Sofa() { std::cout << "~Sofa" << std::endl; } void Sofa::print() const { std::cout << "Sofa: "; Mebel::print(); std::cout << " siedzisko: " << _seat; }
22.882353
126
0.601542
kmalski
5b5600292d5f0d3a1d12f48353f0a1ffa28a0baa
14,199
cpp
C++
lib/SmartSign/Display.cpp
in-tech/SmartSign
476a07ea2606ca80d2193f2957e7b62fb114d05e
[ "MIT" ]
4
2022-01-07T12:38:08.000Z
2022-01-07T14:58:25.000Z
lib/SmartSign/Display.cpp
in-tech/SmartSign
476a07ea2606ca80d2193f2957e7b62fb114d05e
[ "MIT" ]
null
null
null
lib/SmartSign/Display.cpp
in-tech/SmartSign
476a07ea2606ca80d2193f2957e7b62fb114d05e
[ "MIT" ]
2
2022-01-07T12:39:29.000Z
2022-01-07T12:42:25.000Z
#include "Display.h" #include "IAppContext.h" #include <images.h> #include <fonts.h> #include "TimeUtils.h" #include "CryptoUtils.h" #include <qrcode.h> #include "Log.h" extern sIMAGE IMG_background; extern sIMAGE IMG_booked; extern sIMAGE IMG_free; extern sIMAGE IMG_cwa; // Hash of the last content that was presented. // The hash is stored in RTC memory to survive deep-sleep. #define MAX_HASH_SIZE 65 RTC_DATA_ATTR char rtc_lastHash[MAX_HASH_SIZE] = ""; Display::Display(IAppContext& ctx) : _ctx(ctx), _frameBuffer(EPD_WIDTH * EPD_HEIGHT / 4), _paint(_frameBuffer.data(), EPD_WIDTH, EPD_HEIGHT, TWO_BITS), _active(false) { } Display::~Display() { } void Display::Init() { SPI.begin(); pinMode(EPD_CS_PIN, OUTPUT); digitalWrite(EPD_CS_PIN, HIGH); } void Display::DeInit() { if (_active) { _epd.WaitUntilIdle(); _epd.Sleep(); } } void Display::ShowScheduleScreen(const time_t localNow, const std::vector<ScheduleItem>& items) { const String date = TimeUtils::ToDateString(localNow); const String name = _ctx.Settings().DisplayName; const bool lowBattery = _ctx.GetPowerMgr().BatteryIsLow(); String itemsCacheStr; bool booked = false; time_t until = 0; std::vector<ScheduleItem> upcomingItems; for (auto& item : items) { itemsCacheStr += item.Subject; itemsCacheStr += item.LocalStartTime; itemsCacheStr += item.LocalEndTime; itemsCacheStr += (localNow >= item.LocalStartTime) ? "[" : ""; itemsCacheStr += (localNow < item.LocalEndTime) ? "]" : ""; if (booked) { if (until >= item.LocalStartTime) { until = item.LocalEndTime; } } else { if (until == 0 && localNow < item.LocalStartTime) { until = item.LocalStartTime; } } if (localNow < item.LocalEndTime) { upcomingItems.push_back(item); if (localNow >= item.LocalStartTime) { booked = true; until = item.LocalEndTime; } } } if (PrepareHash("ShowScheduleScreen: " + date + name + itemsCacheStr + booked + until + String(lowBattery))) { // fonts sFONT* font = &Overpass_mono28; auto drawText = [&](const int x, const int y, const String& txt, const int color, const TextAlignment alignment = TextAlignment::LEFT) { _paint.DrawUtf8StringAt(x, y - 7, txt.c_str(), font, color, alignment); }; // background _paint.DrawImage(0, 0, &IMG_background); // header drawText(20, 26, date, WHITE); drawText(IMG_background.Width - 20, 26, name, WHITE, TextAlignment::RIGHT); // label sIMAGE* labelImg = &IMG_free; int labelColor = BLACK; if (booked) { labelImg = &IMG_booked; labelColor = RED; } _paint.DrawImage(428 - labelImg->Width / 2, 97, labelImg, labelColor, WHITE); // until if (until > 0) { const String untilStr = String("until ") + TimeUtils::ToShortTimeString(until); drawText(428, 170, untilStr, (booked ? RED : BLACK), TextAlignment::CENTER); } // upcoming for (int i = 0; i < std::min<int>(2, upcomingItems.size()); i++) { const int yOffset = i * 84; const ScheduleItem& item = upcomingItems[i]; int color = BLACK; if (localNow >= item.LocalStartTime && localNow < item.LocalEndTime) { // white font color = WHITE; // red background _paint.DrawFilledRectangle(225, 207 + yOffset, IMG_background.Width - 9, 289 + yOffset, RED); } drawText(240, 226 + yOffset, TimeUtils::ToShortTimeString(item.LocalStartTime), color); drawText(240, 255 + yOffset, TimeUtils::ToShortTimeString(item.LocalEndTime), color); drawText(320, 233 + yOffset, item.Subject.substring(0, 25), color); } // CWA QR-Code if (booked && !upcomingItems.empty() && _ctx.Settings().CwaEventQRCodes) { _paint.DrawFilledRectangle(0, 69, 213, EPD_HEIGHT, WHITE); RenderCwaEventQRCode(*upcomingItems.begin()); } else { // timebars auto drawTimebars = [&](const int x, const time_t tmin, const time_t tmax) { const int yOffset = 69; const time_t timeRange = tmax - tmin; const int pixRange = IMG_background.Height - yOffset; for (auto& item : items) { if (item.LocalStartTime < tmax && item.LocalEndTime > tmin) { const time_t start = max(item.LocalStartTime, tmin); const time_t end = min(item.LocalEndTime, tmax); const int barStart = yOffset + pixRange * (start - tmin) / timeRange; const int barHeight = pixRange * (end - start) / timeRange; _paint.DrawFilledRectangle(x, barStart, x + 40, barStart + barHeight, RED); } } }; time_t midnight = previousMidnight(localNow); drawTimebars(53, midnight + SECS_PER_HOUR * 5 + SECS_PER_MIN * 30, midnight + SECS_PER_HOUR * 12 + SECS_PER_MIN * 30); drawTimebars(163, midnight + SECS_PER_HOUR * 12 + SECS_PER_MIN * 30, midnight + SECS_PER_HOUR * 19 + SECS_PER_MIN * 30); } if (lowBattery) { _paint.DrawImage(IMG_background.Width - 48, IMG_background.Height - 25, &IMG_bat_0); } Present(false); } } void Display::ShowAdminMenuScreen(const String& btnInfoA, const String& btnInfoB) { std::vector<String> lines; lines.push_back(String("Battery : ") + String(_ctx.GetPowerMgr().GetBatteryVoltage(), 1) + "V"); String wifi = _ctx.Settings().WifiSSID; if (wifi.isEmpty()) { wifi += "not configured"; } else if (_ctx.GetNetworkMgr().IsPending()) { wifi += " connecting..."; } else if (!_ctx.GetNetworkMgr().WifiIsConnected()) { wifi += " disconnected"; } lines.push_back(String("WiFi : ") + wifi); time_t utcNow; if (_ctx.GetNetworkMgr().TryGetUtcTime(utcNow)) { time_t localNow = TimeUtils::ToLocalTime(utcNow); lines.push_back(String("DateTime : ") + TimeUtils::ToDateString(localNow) + " " + TimeUtils::ToShortTimeString(localNow)); } else { lines.push_back("DateTime : N/A"); } int maxWidth = 0; String content; for (auto& line : lines) { content += line; content += "$"; maxWidth = std::max<int>(maxWidth, line.length()); } if (PrepareHash("ShowAdminMenuScreen: " + content + btnInfoA + btnInfoB)) { _paint.Clear(WHITE); const int yPos = EPD_HEIGHT / 2 - lines.size() * 11; for (int i = 0; i < lines.size(); i++) { _paint.DrawUtf8StringAt(200, yPos + i * 22, lines[i].c_str(), &Font16, BLACK); } RenderButtonInfos(btnInfoA, btnInfoB, BLACK); RenderFirmwareVersion(); Present(true); } } void Display::ShowSettingsScreen(const String& wifiSsid, const String& wifiKey, const String& btnInfoA, const String& btnInfoB) { const String content = wifiSsid + wifiKey + btnInfoA + btnInfoB; if (PrepareHash("ShowSettingsScreen: " + content)) { _paint.Clear(WHITE); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, 50, "Connect to this WiFi to access the settings screen.", &Font16, BLACK, TextAlignment::CENTER, 31); const String code = String("WIFI:T:WPA;S:") + wifiSsid + ";P:" + wifiKey + ";;";; RenderQRCode(code, EPD_WIDTH / 2 - 87, EPD_HEIGHT / 2 - 87, 174); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT - 80, (String("SSID: ") + wifiSsid).c_str(), &Font16, BLACK, TextAlignment::CENTER); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT - 70 + Font16.Height, (String("Key: ") + wifiKey).c_str(), &Font16, BLACK, TextAlignment::CENTER); RenderButtonInfos(btnInfoA, btnInfoB, BLACK); Present(true); } } void Display::ShowAuthorizationScreen(const String& message, const String& uri, const String& code, const String& btnInfoA, const String& btnInfoB) { const String content = message + uri + code + btnInfoA + btnInfoB; if (PrepareHash("ShowAuthorizationScreen: " + content)) { _paint.Clear(WHITE); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, 30, message.c_str(), &Font16, BLACK, TextAlignment::CENTER, 47); RenderQRCode(uri, EPD_WIDTH / 2 - 87, EPD_HEIGHT / 2 - 87, 174); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT - 74, code.c_str(), &Font16, BLACK, TextAlignment::CENTER); RenderButtonInfos(btnInfoA, btnInfoB, BLACK); Present(true); } } void Display::ShowUnknownCardScreen(const String& header, const String& code, const String& btnInfoA, const String& btnInfoB) { const String content = header + code + btnInfoA + btnInfoB; if (PrepareHash("ShowUnknownCardScreen: " + content)) { _paint.Clear(WHITE); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT / 3, header.c_str(), &Font16, BLACK, TextAlignment::CENTER); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT / 2, code.c_str(), &Font16, BLACK, TextAlignment::CENTER); RenderButtonInfos(btnInfoA, btnInfoB, BLACK); Present(true); } } void Display::ShowInfoScreen(const String& info, const String& btnInfoA, const String& btnInfoB) { if (PrepareHash("ShowInfoScreen: " + info)) { _paint.Clear(WHITE); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT / 3, info.c_str(), &Font16, BLACK, TextAlignment::CENTER, 50); RenderButtonInfos(btnInfoA, btnInfoB, BLACK); Present(true); } } void Display::ShowErrorScreen(const String& error, const String& btnInfoA, const String& btnInfoB) { Log::Error(error); if (PrepareHash("ShowErrorScreen: " + error)) { _paint.Clear(WHITE); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT / 6, "ERROR", &Font16, BLACK, TextAlignment::CENTER); _paint.DrawUtf8StringAt(EPD_WIDTH / 2, EPD_HEIGHT / 3, error.c_str(), &Font16, BLACK, TextAlignment::CENTER, 50); RenderButtonInfos(btnInfoA, btnInfoB, BLACK); Present(true); } } void Display::ShowFontTestScreen() { sFONT* fnt = &Overpass_mono28; auto drawText = [&](const int yOffset, const int height, const int backColor, const int frontColor) { _paint.DrawFilledRectangle(0, yOffset, EPD_WIDTH, yOffset + height, backColor); char c = '0'; for (int y = yOffset + 5; y < yOffset + height - fnt->Height - 5; y += fnt->Height) { for (int x = 5; x < EPD_WIDTH - fnt->Width - 5; x += fnt->Width) { _paint.DrawCharAt(x, y, c, fnt, frontColor); c++; } } }; drawText(0, EPD_HEIGHT / 2, WHITE, BLACK); drawText(EPD_HEIGHT / 2, EPD_HEIGHT / 2, RED, WHITE); Present(false); } void Display::RenderFirmwareVersion() { _paint.DrawUtf8StringAt(EPD_WIDTH - 10, EPD_HEIGHT - 20, SMART_SIGN_FW_VERSION, &Font16, BLACK, TextAlignment::RIGHT); } void Display::RenderQRCode(const String& message, const int x, const int y, const int size, const int version) { QRCode qrcode; std::vector<uint8_t> qrcodeData(qrcode_getBufferSize(version)); qrcode_initText(&qrcode, qrcodeData.data(), version, ECC_LOW, message.c_str()); const int boxSize = size / qrcode.size; for (uint8_t qy = 0; qy < qrcode.size; qy++) { for (uint8_t qx = 0; qx < qrcode.size; qx++) { const int color = qrcode_getModule(&qrcode, qx, qy) ? BLACK : WHITE; const int xPos = x + qx * boxSize; const int yPos = y + qy * boxSize; _paint.DrawFilledRectangle(xPos, yPos, xPos + boxSize - 1, yPos + boxSize - 1, color); } } } void Display::RenderCwaEventQRCode(const ScheduleItem& item) { const int size = 61 * 3; const int xCenter = 214 / 2; const int yTop = 69 + (214 - size) / 2 + 2; const String data = CryptoUtils::CreateCwaEventCode(item, _ctx.Settings().DisplayName); RenderQRCode(data.c_str(), xCenter - size / 2, yTop, size, 11); _paint.DrawImage(xCenter - IMG_cwa.Width / 2, yTop + size + 25, &IMG_cwa, BLACK, RED); } void Display::RenderButtonInfos(const String& btnInfoA, const String& btnInfoB, const int color) { auto renderBtnInfo = [&](const int y, const String& info) { if (!info.isEmpty()) { _paint.DrawUtf8StringAt(20, y + 14, info.c_str(), &Font16, color); _paint.DrawFilledRectangle(0, y, 8, y + 40, color); } }; renderBtnInfo(55, btnInfoA); renderBtnInfo(EPD_HEIGHT - 86, btnInfoB); } bool Display::PrepareHash(const String& content) { // make sure that old hash is null terminated rtc_lastHash[MAX_HASH_SIZE - 1] = '\0'; const String oldHash(rtc_lastHash); const String newHash = CryptoUtils::Sha256(content).substring(0, MAX_HASH_SIZE); if (newHash != oldHash) { Log::Debug(content); // copy new hash to RTC memory newHash.toCharArray(rtc_lastHash, MAX_HASH_SIZE); return true; } return false; } void Display::Present(const bool fastMode) { if (!_active || (fastMode && _epd.IsBusy())) { _active = true; _epd.Init(); } Log::Info("e-paper refresh"); _epd.DisplayFrame( _paint, fastMode ? fastInvertedColorPalette : defaultColorPalette, false); if (fastMode) { delay(4000); _epd.Init(); } } bool Display::IsBusy() { return _active && _epd.IsBusy(); }
32.051919
156
0.595605
in-tech
5b5f1ecb136405854385b4aa313db509d54ff208
17,787
cpp
C++
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32F769I_EVAL/Demonstrations/TouchGFX/Gui/generated/fonts/src/Font_Asap_Bold_otf_27_4bpp.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32F769I_EVAL/Demonstrations/TouchGFX/Gui/generated/fonts/src/Font_Asap_Bold_otf_27_4bpp.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
Tools/STM32FW/STM32Cube_FW_F7_V1.16.2/Projects/STM32F769I_EVAL/Demonstrations/TouchGFX/Gui/generated/fonts/src/Font_Asap_Bold_otf_27_4bpp.cpp
ramkumarkoppu/NUCLEO-F767ZI-ESW
85e129d71ee8eccbd0b94b5e07e75b6b91679ee8
[ "MIT" ]
null
null
null
#include <touchgfx/hal/Types.hpp> FONT_LOCATION_FLASH_PRAGMA KEEP extern const uint8_t unicodes_Asap_Bold_otf_27_4bpp[] FONT_LOCATION_FLASH_ATTRIBUTE = { // Unicode: [0x0020, space] // (Has no glyph data) // Unicode: [0x0030, zero] 0x00,0x00,0xB4,0xFE,0x8D,0x00,0x00,0x00,0x90,0xFF,0xFF,0xFF,0x2D,0x00,0x00,0xF7, 0xFF,0xFF,0xFF,0xDF,0x00,0x10,0xFF,0xFF,0x36,0xFC,0xFF,0x06,0x60,0xFF,0x9F,0x00, 0xF3,0xFF,0x0D,0xB0,0xFF,0x4F,0x00,0xE0,0xFF,0x2F,0xE0,0xFF,0x1F,0x00,0xA0,0xFF, 0x5F,0xF1,0xFF,0x0F,0x00,0x80,0xFF,0x7F,0xF2,0xFF,0x0E,0x00,0x80,0xFF,0x8F,0xF2, 0xFF,0x0E,0x00,0x70,0xFF,0x9F,0xF2,0xFF,0x0E,0x00,0x70,0xFF,0x8F,0xF1,0xFF,0x0F, 0x00,0x80,0xFF,0x7F,0xE0,0xFF,0x1F,0x00,0xA0,0xFF,0x5F,0xB0,0xFF,0x4F,0x00,0xD0, 0xFF,0x2F,0x60,0xFF,0x9F,0x00,0xF3,0xFF,0x0D,0x10,0xFF,0xFF,0x36,0xFC,0xFF,0x07, 0x00,0xF7,0xFF,0xFF,0xFF,0xDF,0x00,0x00,0x90,0xFF,0xFF,0xFF,0x2D,0x00,0x00,0x00, 0xB4,0xFE,0x8D,0x00,0x00, // Unicode: [0x0032, two] 0x00,0x60,0xDA,0xEF,0x8C,0x01,0x00,0x10,0xFD,0xFF,0xFF,0xFF,0x5F,0x00,0x40,0xFF, 0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFE,0x39,0x52,0xFE,0xFF,0x08,0x00,0x11,0x00,0x00, 0xF5,0xFF,0x0B,0x00,0x00,0x00,0x00,0xF3,0xFF,0x0D,0x00,0x00,0x00,0x00,0xF7,0xFF, 0x0B,0x00,0x00,0x00,0x10,0xFE,0xFF,0x07,0x00,0x00,0x00,0xB0,0xFF,0xEF,0x00,0x00, 0x00,0x00,0xF8,0xFF,0x5F,0x00,0x00,0x00,0x50,0xFF,0xFF,0x08,0x00,0x00,0x00,0xF3, 0xFF,0xBF,0x00,0x00,0x00,0x10,0xFE,0xFF,0x1D,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x02, 0x00,0x00,0x00,0xFA,0xFF,0x5F,0x00,0x00,0x00,0x70,0xFF,0xFF,0x19,0x11,0x11,0x00, 0xF1,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0xB0,0xFF, 0xFF,0xFF,0xFF,0xFF,0x0E, // Unicode: [0x0034, four] 0x00,0x00,0x00,0x00,0xF8,0xDF,0x02,0x00,0x00,0x00,0x00,0x40,0xFF,0xFF,0x05,0x00, 0x00,0x00,0x00,0xE1,0xFF,0xFF,0x05,0x00,0x00,0x00,0x00,0xFA,0xFF,0xFF,0x05,0x00, 0x00,0x00,0x50,0xFF,0xFF,0xFF,0x05,0x00,0x00,0x00,0xE1,0xFF,0xFF,0xFF,0x05,0x00, 0x00,0x00,0xFB,0xCF,0xFA,0xFF,0x05,0x00,0x00,0x60,0xFF,0x2F,0xFA,0xFF,0x05,0x00, 0x00,0xF2,0xFF,0x08,0xFA,0xFF,0x05,0x00,0x00,0xFC,0xDF,0x00,0xFA,0xFF,0x05,0x00, 0x70,0xFF,0x4F,0x00,0xFA,0xFF,0x05,0x00,0xF2,0xFF,0x0A,0x00,0xFA,0xFF,0x05,0x00, 0xFA,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x03, 0xF3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x10,0x11,0x11,0x11,0xFA,0xFF,0x06,0x00, 0x00,0x00,0x00,0x00,0xFA,0xFF,0x05,0x00,0x00,0x00,0x00,0x00,0xFA,0xFF,0x05,0x00, 0x00,0x00,0x00,0x00,0xE5,0xDF,0x02,0x00, // Unicode: [0x0038, eight] 0x00,0x00,0xB6,0xFD,0xAD,0x03,0x00,0x00,0xC1,0xFF,0xFF,0xFF,0x9F,0x00,0x00,0xFB, 0xFF,0xFF,0xFF,0xFF,0x06,0x30,0xFF,0xEF,0x24,0xF8,0xFF,0x0C,0x60,0xFF,0x8F,0x00, 0xE0,0xFF,0x0F,0x60,0xFF,0x9F,0x00,0xF0,0xFF,0x0F,0x40,0xFF,0xFF,0x05,0xF8,0xFF, 0x0A,0x00,0xFC,0xFF,0xDF,0xFF,0xEF,0x02,0x00,0xD1,0xFF,0xFF,0xFF,0x2F,0x00,0x00, 0xF8,0xFF,0xFF,0xFF,0xEF,0x02,0x60,0xFF,0xEF,0xA4,0xFF,0xFF,0x0D,0xE0,0xFF,0x3F, 0x00,0xF4,0xFF,0x4F,0xF1,0xFF,0x0F,0x00,0x90,0xFF,0x8F,0xF2,0xFF,0x0D,0x00,0x70, 0xFF,0x9F,0xF0,0xFF,0x1F,0x00,0xA0,0xFF,0x8F,0xD0,0xFF,0xCF,0x23,0xF7,0xFF,0x4F, 0x30,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x00,0xF7,0xFF,0xFF,0xFF,0xCF,0x01,0x00,0x20, 0xD9,0xFF,0xBE,0x06,0x00, // Unicode: [0x0041, A] 0x00,0x00,0x00,0xFC,0xFF,0x06,0x00,0x00,0x00,0x00,0x00,0x40,0xFF,0xFF,0x0D,0x00, 0x00,0x00,0x00,0x00,0x90,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF, 0x8F,0x00,0x00,0x00,0x00,0x00,0xF4,0xFF,0xFF,0xEF,0x00,0x00,0x00,0x00,0x00,0xFA, 0xFF,0xFC,0xFF,0x03,0x00,0x00,0x00,0x00,0xFF,0xEF,0xF6,0xFF,0x09,0x00,0x00,0x00, 0x50,0xFF,0xAF,0xF2,0xFF,0x0E,0x00,0x00,0x00,0xA0,0xFF,0x5F,0xD0,0xFF,0x3F,0x00, 0x00,0x00,0xF0,0xFF,0x0F,0x80,0xFF,0x9F,0x00,0x00,0x00,0xF5,0xFF,0x0A,0x30,0xFF, 0xEF,0x00,0x00,0x00,0xFB,0xFF,0x05,0x00,0xFE,0xFF,0x04,0x00,0x10,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0x09,0x00,0x60,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0E,0x00,0xB0,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0x4F,0x00,0xF1,0xFF,0x7F,0x77,0x77,0xB7,0xFF,0xAF,0x00, 0xF6,0xFF,0x0A,0x00,0x00,0x30,0xFF,0xFF,0x00,0xFC,0xFF,0x05,0x00,0x00,0x00,0xFD, 0xFF,0x05,0xFC,0xCF,0x00,0x00,0x00,0x00,0xF6,0xFF,0x06, // Unicode: [0x0042, B] 0xD0,0xFF,0xFF,0xFF,0xBD,0x17,0x00,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x00, 0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x2F,0x00,0xF2,0xFF,0x7F,0x87,0xFD,0xFF,0x6F,0x00, 0xF2,0xFF,0x0F,0x00,0xE0,0xFF,0x9F,0x00,0xF2,0xFF,0x0F,0x00,0xA0,0xFF,0x8F,0x00, 0xF2,0xFF,0x0F,0x00,0xC0,0xFF,0x3F,0x00,0xF2,0xFF,0x0F,0x10,0xF8,0xFF,0x09,0x00, 0xF2,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xAF,0x02,0x00, 0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x4F,0x00,0xF2,0xFF,0x7F,0x77,0xFA,0xFF,0xDF,0x00, 0xF2,0xFF,0x0F,0x00,0x20,0xFF,0xFF,0x03,0xF2,0xFF,0x0F,0x00,0x00,0xFE,0xFF,0x06, 0xF2,0xFF,0x0F,0x00,0x20,0xFF,0xFF,0x03,0xF2,0xFF,0x7F,0x77,0xE9,0xFF,0xFF,0x01, 0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0xAF,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x00, 0xD0,0xFF,0xFF,0xFF,0xCE,0x4A,0x00,0x00, // Unicode: [0x0043, C] 0x00,0x00,0x71,0xEB,0xFF,0xCE,0x49,0x00,0x00,0x70,0xFF,0xFF,0xFF,0xFF,0xFF,0x0A, 0x00,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0x09,0x50,0xFF,0xFF,0xCF,0x89,0xC9,0xFF,0x02, 0xD0,0xFF,0xEF,0x03,0x00,0x00,0x21,0x00,0xF4,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00, 0xF7,0xFF,0x0E,0x00,0x00,0x00,0x00,0x00,0xFA,0xFF,0x0B,0x00,0x00,0x00,0x00,0x00, 0xFB,0xFF,0x09,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x08,0x00,0x00,0x00,0x00,0x00, 0xFB,0xFF,0x09,0x00,0x00,0x00,0x00,0x00,0xFA,0xFF,0x0B,0x00,0x00,0x00,0x00,0x00, 0xF8,0xFF,0x0E,0x00,0x00,0x00,0x00,0x00,0xF4,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00, 0xE0,0xFF,0xEF,0x03,0x00,0x00,0x62,0x00,0x70,0xFF,0xFF,0xBF,0x78,0xC9,0xFF,0x09, 0x00,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x90,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B, 0x00,0x00,0x82,0xEC,0xFF,0xCE,0x39,0x00, // Unicode: [0x0045, E] 0xD0,0xFF,0xFF,0xFF,0xFF,0xFF,0x06,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x0A,0xF2,0xFF, 0xFF,0xFF,0xFF,0xFF,0x09,0xF2,0xFF,0x7F,0x77,0x77,0x77,0x01,0xF2,0xFF,0x0F,0x00, 0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00, 0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xAF,0x00,0xF2, 0xFF,0xFF,0xFF,0xFF,0xEF,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xDF,0x00,0xF2,0xFF,0x7F, 0x77,0x77,0x37,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00, 0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0xF2,0xFF,0x7F,0x77,0x77,0x77,0x02, 0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x09,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x0A,0xD0,0xFF, 0xFF,0xFF,0xFF,0xFF,0x06, // Unicode: [0x0048, H] 0xE7,0xDF,0x03,0x00,0x00,0x10,0xFD,0xAF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF, 0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFB,0xFF,0x7B,0x77,0x77,0x97,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF,0xFB,0xFF,0x07,0x00,0x00,0x40,0xFF,0xEF, 0xF7,0xEF,0x03,0x00,0x00,0x10,0xFD,0xAF, // Unicode: [0x0050, P] 0xD0,0xFF,0xFF,0xFF,0xCE,0x17,0x00,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x00, 0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x2F,0x00,0xF2,0xFF,0x7F,0x77,0xFB,0xFF,0x9F,0x00, 0xF2,0xFF,0x0F,0x00,0xA0,0xFF,0xDF,0x00,0xF2,0xFF,0x0F,0x00,0x50,0xFF,0xFF,0x00, 0xF2,0xFF,0x0F,0x00,0x50,0xFF,0xFF,0x00,0xF2,0xFF,0x0F,0x00,0xA0,0xFF,0xDF,0x00, 0xF2,0xFF,0x7F,0x87,0xFB,0xFF,0x8F,0x00,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x1E,0x00, 0xF2,0xFF,0xFF,0xFF,0xFF,0xEF,0x03,0x00,0xF2,0xFF,0xFF,0xFF,0xCE,0x06,0x00,0x00, 0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00, 0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00, 0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00, 0xC0,0xFF,0x0B,0x00,0x00,0x00,0x00,0x00, // Unicode: [0x0054, T] 0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x09, 0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x08,0x72,0x77,0xD7,0xFF,0xBF,0x77,0x77,0x01, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x00,0x00,0x00, 0x00,0x00,0x60,0xFE,0x4E,0x00,0x00,0x00, // Unicode: [0x0056, V] 0xFA,0xDF,0x01,0x00,0x00,0x00,0xE5,0xEF,0x04,0xF9,0xFF,0x07,0x00,0x00,0x00,0xFD, 0xFF,0x03,0xF4,0xFF,0x0C,0x00,0x00,0x20,0xFF,0xDF,0x00,0xE0,0xFF,0x1F,0x00,0x00, 0x80,0xFF,0x8F,0x00,0x90,0xFF,0x6F,0x00,0x00,0xD0,0xFF,0x2F,0x00,0x40,0xFF,0xBF, 0x00,0x00,0xF2,0xFF,0x0D,0x00,0x00,0xFE,0xFF,0x00,0x00,0xF7,0xFF,0x08,0x00,0x00, 0xF9,0xFF,0x05,0x00,0xFC,0xFF,0x02,0x00,0x00,0xF4,0xFF,0x0A,0x10,0xFF,0xDF,0x00, 0x00,0x00,0xE0,0xFF,0x0E,0x60,0xFF,0x8F,0x00,0x00,0x00,0x90,0xFF,0x4F,0xB0,0xFF, 0x2F,0x00,0x00,0x00,0x40,0xFF,0x9F,0xF1,0xFF,0x0D,0x00,0x00,0x00,0x00,0xFE,0xEF, 0xF5,0xFF,0x07,0x00,0x00,0x00,0x00,0xF9,0xFF,0xFD,0xFF,0x02,0x00,0x00,0x00,0x00, 0xF3,0xFF,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x7F,0x00,0x00,0x00, 0x00,0x00,0x90,0xFF,0xFF,0x2F,0x00,0x00,0x00,0x00,0x00,0x30,0xFF,0xFF,0x0D,0x00, 0x00,0x00,0x00,0x00,0x00,0xFB,0xFF,0x05,0x00,0x00,0x00, // Unicode: [0x0061, a] 0x00,0xB7,0xFE,0xDF,0x4B,0x00,0x00,0xD0,0xFF,0xFF,0xFF,0xFF,0x0B,0x00,0xD0,0xFF, 0xFF,0xFF,0xFF,0x7F,0x00,0x40,0x8D,0x23,0xA2,0xFF,0xBF,0x00,0x00,0x00,0x00,0x20, 0xFF,0xDF,0x00,0x00,0x00,0x63,0x97,0xFF,0xEF,0x00,0x10,0xF9,0xFF,0xFF,0xFF,0xEF, 0x00,0xD1,0xFF,0xFF,0xFF,0xFF,0xEF,0x00,0xF8,0xFF,0x5D,0x21,0xFF,0xEF,0x00,0xFC, 0xFF,0x03,0x40,0xFF,0xEF,0x00,0xFD,0xFF,0x28,0xF6,0xFF,0xFF,0x00,0xFA,0xFF,0xFF, 0xFF,0xFF,0xFF,0x00,0xF3,0xFF,0xFF,0x9F,0xFC,0xFF,0x01,0x30,0xEB,0xCF,0x05,0xF7, 0xAD,0x00, // Unicode: [0x0064, d] 0x00,0x00,0x00,0x00,0xE3,0xEF,0x05,0x00,0x00,0x00,0x00,0xF6,0xFF,0x09,0x00,0x00, 0x00,0x00,0xF6,0xFF,0x09,0x00,0x00,0x00,0x00,0xF6,0xFF,0x09,0x00,0x00,0x00,0x00, 0xF6,0xFF,0x09,0x00,0x00,0x00,0x00,0xF6,0xFF,0x09,0x00,0x80,0xFD,0xBE,0xF9,0xFF, 0x09,0x10,0xFD,0xFF,0xFF,0xFF,0xFF,0x09,0xA0,0xFF,0xFF,0xFF,0xFF,0xFF,0x09,0xF3, 0xFF,0x7F,0x32,0xFB,0xFF,0x09,0xF8,0xFF,0x0A,0x00,0xF6,0xFF,0x09,0xFA,0xFF,0x05, 0x00,0xF6,0xFF,0x09,0xFC,0xFF,0x03,0x00,0xF6,0xFF,0x09,0xFC,0xFF,0x03,0x00,0xF6, 0xFF,0x09,0xFA,0xFF,0x05,0x00,0xF6,0xFF,0x09,0xF8,0xFF,0x09,0x00,0xFA,0xFF,0x09, 0xF3,0xFF,0x7F,0x93,0xFF,0xFF,0x0A,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0B,0x30,0xFF, 0xFF,0xFF,0xF8,0xFF,0x0D,0x00,0x92,0xFD,0x5C,0xC0,0xDF,0x07, // Unicode: [0x0065, e] 0x00,0x50,0xDA,0xEF,0x6C,0x00,0x00,0x10,0xFC,0xFF,0xFF,0xFF,0x0B,0x00,0xB0,0xFF, 0xFF,0xFF,0xFF,0x7F,0x00,0xF3,0xFF,0x6F,0x52,0xFE,0xEF,0x00,0xF8,0xFF,0x09,0x00, 0xF8,0xFF,0x04,0xFB,0xFF,0x9B,0x99,0xFC,0xFF,0x06,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF, 0x07,0xFC,0xFF,0xFF,0xFF,0xFF,0xBF,0x00,0xFA,0xFF,0x06,0x00,0x00,0x00,0x00,0xF8, 0xFF,0x0B,0x00,0x00,0x00,0x00,0xF3,0xFF,0x9F,0x13,0x83,0x4D,0x00,0xA0,0xFF,0xFF, 0xFF,0xFF,0xDF,0x00,0x00,0xFA,0xFF,0xFF,0xFF,0xDF,0x00,0x00,0x40,0xDA,0xFF,0xAC, 0x06,0x00, // Unicode: [0x0069, i] 0xE3,0xEF,0x05,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xB2,0xBD,0x03,0x00,0x00,0x00,0x00, 0x00,0x00,0xE3,0xEF,0x05,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF, 0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09, 0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xF6,0xFF,0x09,0xE3,0xEF,0x05, // Unicode: [0x006C, l] 0xD1,0xEF,0x07,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00, 0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00, 0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00, 0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00,0xF4,0xFF,0x0B,0x00, 0xF3,0xFF,0x4E,0x01,0xF0,0xFF,0xFF,0x0E,0x80,0xFF,0xFF,0x2F,0x00,0xD7,0xEF,0x0B, // Unicode: [0x006D, m] 0xC4,0xEE,0x11,0xD9,0xEF,0x19,0x30,0xEB,0xCF,0x06,0x00,0xF9,0xFF,0xD8,0xFF,0xFF, 0xCF,0xF7,0xFF,0xFF,0x6F,0x00,0xF7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xDF, 0x00,0xF6,0xFF,0xBF,0x64,0xFF,0xFF,0x9F,0x84,0xFF,0xFF,0x00,0xF5,0xFF,0x0D,0x00, 0xFB,0xFF,0x09,0x00,0xFF,0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06,0x00,0xFE, 0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06,0x00,0xFE,0xFF,0x01,0xF5,0xFF,0x0A, 0x00,0xF9,0xFF,0x06,0x00,0xFE,0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06,0x00, 0xFE,0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06,0x00,0xFE,0xFF,0x01,0xF5,0xFF, 0x0A,0x00,0xF9,0xFF,0x06,0x00,0xFE,0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06, 0x00,0xFE,0xFF,0x01,0xF5,0xFF,0x0A,0x00,0xF9,0xFF,0x06,0x00,0xFE,0xFF,0x01,0xD2, 0xEF,0x06,0x00,0xE5,0xEF,0x03,0x00,0xF9,0xCF,0x00, // Unicode: [0x006E, n] 0xC4,0xEE,0x11,0xD8,0xDF,0x09,0x00,0xF9,0xFF,0xD8,0xFF,0xFF,0xBF,0x00,0xF7,0xFF, 0xFF,0xFF,0xFF,0xFF,0x03,0xF6,0xFF,0xCF,0x54,0xFF,0xFF,0x05,0xF5,0xFF,0x0D,0x00, 0xF9,0xFF,0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF, 0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xF5, 0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xF5,0xFF,0x0A, 0x00,0xF8,0xFF,0x07,0xF5,0xFF,0x0A,0x00,0xF8,0xFF,0x07,0xD2,0xEF,0x06,0x00,0xE5, 0xEF,0x03, // Unicode: [0x006F, o] 0x00,0x50,0xEB,0xEF,0x8C,0x01,0x00,0x10,0xFC,0xFF,0xFF,0xFF,0x4F,0x00,0xB0,0xFF, 0xFF,0xFF,0xFF,0xFF,0x02,0xF3,0xFF,0x7F,0x42,0xFE,0xFF,0x09,0xF8,0xFF,0x0A,0x00, 0xF4,0xFF,0x0E,0xFA,0xFF,0x05,0x00,0xF0,0xFF,0x0F,0xFC,0xFF,0x03,0x00,0xD0,0xFF, 0x2F,0xFC,0xFF,0x03,0x00,0xD0,0xFF,0x2F,0xFA,0xFF,0x05,0x00,0xF0,0xFF,0x0F,0xF8, 0xFF,0x0A,0x00,0xF4,0xFF,0x0E,0xF3,0xFF,0x7F,0x42,0xFE,0xFF,0x09,0xB0,0xFF,0xFF, 0xFF,0xFF,0xFF,0x02,0x10,0xFC,0xFF,0xFF,0xFF,0x4F,0x00,0x00,0x50,0xEB,0xFF,0x8D, 0x01,0x00, // Unicode: [0x0072, r] 0xC4,0xEE,0x51,0xFD,0x08,0xF9,0xFF,0xF9,0xFF,0x0E,0xF7,0xFF,0xFF,0xFF,0x0B,0xF6, 0xFF,0xDF,0x78,0x02,0xF5,0xFF,0x1D,0x00,0x00,0xF5,0xFF,0x0A,0x00,0x00,0xF5,0xFF, 0x0A,0x00,0x00,0xF5,0xFF,0x0A,0x00,0x00,0xF5,0xFF,0x0A,0x00,0x00,0xF5,0xFF,0x0A, 0x00,0x00,0xF5,0xFF,0x0A,0x00,0x00,0xF5,0xFF,0x0A,0x00,0x00,0xF5,0xFF,0x0A,0x00, 0x00,0xD2,0xEF,0x06,0x00,0x00, // Unicode: [0x0074, t] 0x00,0x61,0x47,0x00,0x00,0x00,0xF8,0xFF,0x00,0x00,0x00,0xFB,0xFF,0x01,0x00,0x00, 0xFD,0xFF,0x01,0x00,0xE0,0xFF,0xFF,0xEF,0x00,0xF2,0xFF,0xFF,0xFF,0x03,0xF0,0xFF, 0xFF,0xFF,0x01,0x00,0xFE,0xFF,0x02,0x00,0x00,0xFE,0xFF,0x01,0x00,0x00,0xFE,0xFF, 0x01,0x00,0x00,0xFE,0xFF,0x01,0x00,0x00,0xFE,0xFF,0x01,0x00,0x00,0xFE,0xFF,0x01, 0x00,0x00,0xFE,0xFF,0x01,0x00,0x00,0xFD,0xFF,0x27,0x00,0x00,0xFA,0xFF,0xFF,0x04, 0x00,0xF2,0xFF,0xFF,0x08,0x00,0x30,0xEB,0xDF,0x03, // Unicode: [0x0075, u] 0xE3,0xEF,0x05,0x00,0xE6,0xDF,0x02,0xF6,0xFF,0x09,0x00,0xFA,0xFF,0x05,0xF6,0xFF, 0x09,0x00,0xFA,0xFF,0x05,0xF6,0xFF,0x09,0x00,0xFA,0xFF,0x05,0xF6,0xFF,0x09,0x00, 0xFA,0xFF,0x05,0xF6,0xFF,0x09,0x00,0xFA,0xFF,0x05,0xF6,0xFF,0x09,0x00,0xFA,0xFF, 0x05,0xF6,0xFF,0x09,0x00,0xFA,0xFF,0x05,0xF6,0xFF,0x09,0x00,0xFA,0xFF,0x05,0xF6, 0xFF,0x0A,0x00,0xFD,0xFF,0x06,0xF5,0xFF,0x5F,0xB4,0xFF,0xFF,0x06,0xF2,0xFF,0xFF, 0xFF,0xFF,0xFF,0x07,0xB0,0xFF,0xFF,0xDF,0xF7,0xFF,0x09,0x00,0xD8,0xDF,0x18,0xE1, 0xCE,0x05, // Unicode: [0x0077, w] 0xE5,0xEF,0x03,0x00,0xF6,0xDF,0x01,0x00,0xF9,0x5E,0xF5,0xFF,0x08,0x00,0xFC,0xFF, 0x05,0x00,0xFF,0x6F,0xF1,0xFF,0x0C,0x00,0xFF,0xFF,0x09,0x30,0xFF,0x2F,0xC0,0xFF, 0x1F,0x40,0xFF,0xFF,0x0D,0x80,0xFF,0x0E,0x80,0xFF,0x5F,0x80,0xFF,0xFF,0x1F,0xC0, 0xFF,0x09,0x30,0xFF,0x9F,0xC0,0xFF,0xFF,0x4F,0xF0,0xFF,0x05,0x00,0xFF,0xDF,0xF0, 0xFF,0xFC,0x8F,0xF5,0xFF,0x01,0x00,0xFB,0xFF,0xF5,0xBF,0xF8,0xCF,0xF9,0xDF,0x00, 0x00,0xF6,0xFF,0xFD,0x7F,0xF4,0xFF,0xFE,0x9F,0x00,0x00,0xF2,0xFF,0xFF,0x3F,0xF0, 0xFF,0xFF,0x5F,0x00,0x00,0xE0,0xFF,0xFF,0x0F,0xC0,0xFF,0xFF,0x1F,0x00,0x00,0x90, 0xFF,0xFF,0x0B,0x70,0xFF,0xFF,0x0D,0x00,0x00,0x50,0xFF,0xFF,0x07,0x30,0xFF,0xFF, 0x08,0x00,0x00,0x00,0xFD,0xEF,0x02,0x00,0xFC,0xEF,0x03,0x00, // Unicode: [0x0078, x] 0xF6,0xFF,0x08,0x00,0xE3,0xFF,0x0A,0xF2,0xFF,0x3F,0x00,0xFD,0xFF,0x05,0x70,0xFF, 0xDF,0x80,0xFF,0xAF,0x00,0x00,0xFC,0xFF,0xFA,0xFF,0x1E,0x00,0x00,0xF2,0xFF,0xFF, 0xFF,0x04,0x00,0x00,0x60,0xFF,0xFF,0x9F,0x00,0x00,0x00,0x00,0xFC,0xFF,0x0E,0x00, 0x00,0x00,0x00,0xFD,0xFF,0x2F,0x00,0x00,0x00,0x90,0xFF,0xFF,0xCF,0x00,0x00,0x00, 0xF4,0xFF,0xFF,0xFF,0x06,0x00,0x10,0xFE,0xFF,0xF6,0xFF,0x2F,0x00,0xA0,0xFF,0x9F, 0x80,0xFF,0xCF,0x00,0xF5,0xFF,0x0E,0x00,0xFD,0xFF,0x06,0xFA,0xEF,0x04,0x00,0xE3, 0xFF,0x0B, // Unicode: [0x0079, y] 0xF8,0xEF,0x03,0x00,0xB0,0xFF,0x0A,0xF7,0xFF,0x09,0x00,0xF3,0xFF,0x0A,0xF1,0xFF, 0x0E,0x00,0xF8,0xFF,0x04,0xC0,0xFF,0x4F,0x00,0xFE,0xEF,0x00,0x60,0xFF,0x9F,0x30, 0xFF,0x9F,0x00,0x10,0xFF,0xEF,0x80,0xFF,0x3F,0x00,0x00,0xFB,0xFF,0xC2,0xFF,0x0D, 0x00,0x00,0xF5,0xFF,0xF7,0xFF,0x08,0x00,0x00,0xF0,0xFF,0xFE,0xFF,0x02,0x00,0x00, 0xA0,0xFF,0xFF,0xCF,0x00,0x00,0x00,0x40,0xFF,0xFF,0x6F,0x00,0x00,0x00,0x00,0xFE, 0xFF,0x1F,0x00,0x00,0x00,0x00,0xF9,0xFF,0x0B,0x00,0x00,0x00,0x00,0xF4,0xFF,0x05, 0x00,0x00,0x00,0x00,0xF8,0xFF,0x00,0x00,0x00,0x00,0x00,0xFE,0xAF,0x00,0x00,0x00, 0x00,0x40,0xFF,0x4F,0x00,0x00,0x00,0x00,0xA0,0xFF,0x0E,0x00,0x00,0x00,0x00,0xC0, 0xFF,0x07,0x00,0x00,0x00, // Unicode: [0x007A, z] 0x90,0xFF,0xFF,0xFF,0xFF,0xDF,0x00,0xD0,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0xA0,0xFF, 0xFF,0xFF,0xFF,0xFF,0x02,0x00,0x11,0x11,0xF6,0xFF,0x7F,0x00,0x00,0x00,0x10,0xFE, 0xFF,0x0B,0x00,0x00,0x00,0xC0,0xFF,0xEF,0x01,0x00,0x00,0x00,0xF7,0xFF,0x4F,0x00, 0x00,0x00,0x30,0xFF,0xFF,0x09,0x00,0x00,0x00,0xE1,0xFF,0xDF,0x00,0x00,0x00,0x00, 0xFA,0xFF,0x2F,0x00,0x00,0x00,0x60,0xFF,0xFF,0x17,0x11,0x01,0x00,0xF2,0xFF,0xFF, 0xFF,0xFF,0xFF,0x03,0xF2,0xFF,0xFF,0xFF,0xFF,0xFF,0x06,0xD0,0xFF,0xFF,0xFF,0xFF, 0xFF,0x03 };
68.675676
92
0.782088
ramkumarkoppu
5b6eb1a8f650508647ebb1d09defc4bcc8314938
451
cpp
C++
src/robotics/genetico.cpp
pcamarillor/Exploratory3D
10705d201376b98bdf8f19fca398a3bf341807c9
[ "MIT" ]
null
null
null
src/robotics/genetico.cpp
pcamarillor/Exploratory3D
10705d201376b98bdf8f19fca398a3bf341807c9
[ "MIT" ]
null
null
null
src/robotics/genetico.cpp
pcamarillor/Exploratory3D
10705d201376b98bdf8f19fca398a3bf341807c9
[ "MIT" ]
null
null
null
#include "genetico.h" genetico::genetico() { this->numGeneraciones = 100; this->tamPoblacion = 20; this->pCruza = 0.8; this->pMutacion = 0.2; } genetico::genetico(int _nGeneraciones, int _tPoblacion, float _pCruza, float _pMutacion) { this->numGeneraciones = _nGeneraciones; this->tamPoblacion = _tPoblacion; this->pCruza = _pCruza; this->pMutacion = _pMutacion; } genetico::~genetico() { }
18.791667
89
0.640798
pcamarillor
ac8e0fdaba7552f4373146f3be78ecf133f34d4b
10,011
cc
C++
build/X86_MESI_Two_Level/python/m5/internal/param_TaggedPrefetcher.py.cc
hoho20000000/gem5-fy
b59f6feed22896d6752331652c4d8a41a4ca4435
[ "BSD-3-Clause" ]
null
null
null
build/X86_MESI_Two_Level/python/m5/internal/param_TaggedPrefetcher.py.cc
hoho20000000/gem5-fy
b59f6feed22896d6752331652c4d8a41a4ca4435
[ "BSD-3-Clause" ]
1
2020-08-20T05:53:30.000Z
2020-08-20T05:53:30.000Z
build/X86_MESI_Two_Level/python/m5/internal/param_TaggedPrefetcher.py.cc
hoho20000000/gem5-fy
b59f6feed22896d6752331652c4d8a41a4ca4435
[ "BSD-3-Clause" ]
null
null
null
#include "sim/init.hh" namespace { const uint8_t data_m5_internal_param_TaggedPrefetcher[] = { 120,156,197,88,123,111,219,200,17,159,165,94,150,108,217,114, 252,202,195,62,51,137,221,168,143,216,109,15,110,175,189,52, 104,146,166,197,1,141,47,165,3,36,81,11,16,52,185,146, 105,75,164,74,174,226,40,144,255,104,29,180,247,97,250,95, 63,89,63,65,59,51,75,210,180,108,1,1,122,167,147,173, 213,114,57,251,152,249,253,102,118,118,93,72,62,183,240,251, 91,19,32,254,143,0,240,240,95,192,9,64,87,64,203,0, 33,13,240,150,224,184,4,225,45,16,94,9,62,2,180,10, 32,11,112,142,149,34,252,185,0,193,231,90,106,57,147,170, 92,39,85,199,23,56,246,12,156,20,185,201,128,97,13,100, 9,90,101,120,29,44,65,81,86,224,184,6,97,5,4,126, 2,156,249,205,176,1,73,143,25,104,85,81,106,19,165,106, 44,181,196,82,201,219,42,189,229,30,94,21,188,26,124,196, 149,207,130,55,203,171,152,3,111,142,43,117,240,234,92,153, 7,111,158,43,11,233,240,13,104,45,166,245,27,185,250,82, 174,190,156,171,175,228,234,171,185,250,90,174,126,51,87,191, 149,171,223,206,213,239,228,234,235,185,250,6,215,23,64,46, 130,255,25,248,155,224,155,208,22,224,53,104,217,104,209,183, 173,187,32,139,224,223,131,214,61,144,248,127,23,206,5,154, 119,49,215,227,62,247,184,145,245,216,226,30,219,208,218,6, 137,255,91,186,199,12,28,52,87,16,126,255,191,248,105,34, 252,160,230,176,120,39,163,216,15,3,219,15,218,161,111,208, 251,10,21,68,22,151,138,2,126,203,248,125,70,172,137,128, 41,131,107,71,214,156,225,8,2,176,143,103,208,12,94,1, 110,157,9,122,240,11,48,194,74,17,218,252,194,47,38,18, 103,200,131,69,24,225,232,37,24,113,203,193,235,96,3,138, 170,204,64,47,50,208,250,53,118,166,215,8,51,224,178,75, 56,237,62,175,91,209,186,119,120,117,106,13,11,187,239,68, 78,207,126,229,116,58,210,123,25,201,182,84,238,145,140,154, 164,131,170,146,34,189,126,24,169,174,127,168,102,72,220,14, 156,158,180,109,85,195,135,8,251,42,95,161,242,170,136,143, 199,161,31,40,210,180,27,171,200,239,171,122,214,219,238,133, 222,160,43,213,44,182,124,197,45,207,163,40,140,154,100,26, 139,10,69,69,255,164,163,104,161,61,154,162,73,43,228,34, 110,97,177,123,20,246,36,22,65,103,56,216,237,200,222,222, 195,246,112,247,112,224,119,189,221,55,95,252,194,126,241,252, 224,43,251,213,105,104,255,81,190,147,221,221,254,80,161,232, 110,111,111,23,87,36,163,192,193,166,107,213,220,65,201,27, 52,199,169,223,177,147,181,30,201,110,95,70,164,122,60,79, 243,139,57,177,36,62,19,5,177,40,230,133,95,78,97,37, 3,213,83,88,255,149,192,106,36,193,0,145,21,9,204,6, 156,113,133,176,107,18,172,132,102,129,64,68,101,17,162,142, 128,115,3,254,82,32,129,51,44,139,232,187,102,6,233,178, 246,93,61,84,5,206,16,247,18,161,250,97,157,135,154,225, 161,12,24,97,137,128,23,225,12,3,4,138,98,19,150,199, 85,8,231,65,224,131,95,37,98,139,0,105,252,102,84,70, 66,20,51,66,104,34,147,54,158,31,145,229,45,226,112,179, 150,182,134,241,78,223,81,71,86,61,133,9,205,196,112,239, 135,129,70,180,237,7,94,138,176,230,72,219,239,34,71,44, 178,33,143,198,98,221,208,201,196,8,102,183,27,198,146,121, 198,99,91,11,36,72,210,237,62,15,67,179,210,122,184,179, 39,99,151,56,133,92,211,35,210,10,104,180,169,241,196,34, 95,95,166,121,110,51,43,26,200,139,50,178,162,137,172,208, 181,117,163,46,22,196,190,79,6,117,75,137,215,23,83,138, 252,27,52,44,2,142,13,118,213,17,7,9,148,70,240,216, 85,71,28,8,232,237,79,64,40,35,105,199,88,128,24,83, 235,13,236,195,196,65,6,161,236,35,242,108,134,148,152,80, 2,164,166,134,29,233,164,121,194,224,151,168,7,13,101,208, 20,69,232,175,225,224,51,196,136,17,36,212,57,47,32,53, 112,69,232,212,24,54,176,121,21,231,253,59,115,46,9,29, 204,4,117,228,199,225,169,246,117,170,115,244,59,64,207,121, 57,252,250,240,88,186,42,222,196,134,183,225,192,116,157,32, 8,149,233,120,158,233,40,140,5,135,3,37,99,83,133,230, 118,220,36,52,173,219,41,153,178,241,134,125,105,113,69,51, 200,243,93,133,81,102,137,31,216,59,99,169,144,11,71,161, 23,99,59,117,237,72,101,53,168,7,153,57,228,5,48,85, 108,18,165,105,81,142,28,248,73,186,2,29,115,202,41,123, 98,217,109,115,24,115,187,78,28,219,180,2,110,103,206,145, 214,239,156,238,64,242,232,49,142,135,11,162,170,94,195,244, 162,211,77,210,40,53,0,107,21,132,129,55,196,69,250,238, 231,52,255,77,102,99,29,163,83,93,172,226,183,42,86,68, 5,57,89,17,107,134,91,76,24,152,237,63,171,164,61,48, 244,34,65,31,25,121,142,49,165,105,112,72,96,197,136,193, 214,143,168,70,157,173,45,42,182,169,248,1,21,15,82,221, 167,98,128,250,184,1,158,209,164,6,107,237,22,18,253,50, 47,179,47,121,217,124,206,203,206,201,91,70,188,221,250,133, 156,167,20,200,6,225,108,234,91,236,137,8,63,122,34,9, 179,79,225,46,156,247,8,154,116,223,162,68,48,190,139,197, 131,237,248,129,169,249,103,30,57,177,25,132,23,164,55,233, 165,142,113,68,121,107,157,204,159,35,117,39,71,106,203,36, 9,98,180,117,159,138,226,36,251,255,240,123,178,127,71,219, 255,15,52,233,92,194,186,121,102,219,172,112,137,50,4,74, 37,69,226,0,43,195,53,66,34,15,193,26,110,134,175,131, 117,220,223,24,6,218,226,234,122,139,227,125,82,39,166,105, 144,243,75,105,165,76,96,180,11,176,154,236,92,49,109,45, 253,40,124,63,52,195,182,169,32,93,210,163,237,120,103,59, 254,18,227,140,249,248,194,236,73,76,137,100,159,98,130,142, 17,100,28,229,7,248,76,67,61,127,239,74,222,92,248,201, 182,117,72,208,89,142,157,108,90,136,16,67,98,164,144,112, 80,196,84,135,98,225,244,240,168,101,120,144,62,47,105,198, 26,131,81,16,107,24,4,114,80,208,183,64,80,16,225,254, 9,156,227,10,248,7,144,161,209,156,137,199,179,15,165,126, 180,68,226,148,222,140,196,181,59,149,145,248,135,145,68,16, 116,160,126,157,55,160,100,231,194,124,229,155,92,120,201,118, 150,66,146,243,228,253,168,152,249,17,163,244,73,187,71,241, 178,43,17,2,232,115,36,198,78,163,51,202,173,203,161,138, 19,156,2,71,124,53,21,136,102,244,92,54,45,235,237,5, 64,20,163,55,196,178,161,185,194,52,250,37,21,95,100,254, 44,210,182,239,122,133,155,227,65,53,183,171,216,58,34,189, 161,101,20,121,225,11,21,69,97,105,124,32,78,131,233,67, 155,229,83,98,206,207,177,34,241,176,40,64,114,124,253,200, 89,49,149,6,225,127,110,8,60,232,98,138,241,145,15,186, 250,60,107,233,20,131,89,155,126,57,128,80,224,185,20,189, 115,118,203,24,160,193,165,226,253,244,92,144,240,125,212,117, 122,135,158,243,248,175,52,31,77,234,166,46,103,164,10,52, 242,10,144,179,136,9,58,240,227,151,169,34,239,166,151,210, 62,194,225,51,5,216,69,188,208,229,112,241,234,72,154,61, 217,59,196,179,237,145,223,55,219,93,167,195,8,21,18,5, 191,78,21,84,12,113,206,171,57,168,196,148,60,236,135,166, 27,6,24,32,7,174,10,35,211,147,120,80,144,158,249,208, 228,232,106,250,177,233,28,226,91,199,85,154,248,151,29,152, 115,49,39,234,196,156,118,157,156,82,117,186,16,219,120,164, 247,49,11,37,235,36,9,135,222,83,56,8,81,242,197,249, 165,246,35,220,140,240,212,168,134,58,158,61,161,98,143,138, 93,200,111,214,83,65,245,215,56,124,159,230,33,195,149,197, 29,163,106,168,213,107,252,247,37,141,16,95,245,226,195,79, 241,98,89,132,86,41,245,229,50,73,202,10,157,71,169,172, 210,190,208,194,195,132,190,1,155,229,198,57,190,85,42,39, 183,74,232,245,149,255,211,235,217,99,166,235,43,31,190,77, 103,183,126,243,253,173,223,122,12,73,94,48,201,209,69,94, 185,186,118,116,95,164,25,50,3,176,175,117,225,227,248,198, 68,126,217,110,36,29,37,53,100,91,211,84,153,3,135,158, 253,236,194,133,179,244,168,148,106,247,251,76,187,115,206,141, 134,203,140,100,122,13,71,119,127,124,157,170,56,35,165,148, 181,161,47,218,216,28,182,145,100,173,144,153,165,156,153,133, 96,15,228,233,149,213,105,211,232,228,148,164,157,126,95,6, 158,245,83,234,248,51,200,39,153,44,51,61,150,80,224,250, 27,100,41,203,28,102,149,203,152,182,92,245,83,138,129,57, 149,25,221,70,230,154,83,197,153,169,253,77,74,237,38,221, 35,93,132,104,235,41,21,28,148,179,120,108,61,207,0,186, 59,153,183,158,236,68,82,210,169,231,19,164,48,141,98,32, 245,35,155,145,125,194,147,93,169,228,4,252,57,171,74,78, 130,158,196,173,48,28,226,153,163,194,141,216,209,182,167,188, 113,208,201,122,8,201,189,39,110,28,162,140,91,199,138,81, 45,87,5,239,203,99,183,219,185,182,114,214,70,105,183,78, 182,135,177,69,45,138,108,159,236,145,188,24,59,127,97,206, 183,106,26,10,190,243,75,119,81,66,141,207,98,251,78,79, 95,220,240,251,228,212,22,107,79,225,251,69,202,52,172,31, 83,241,48,3,249,87,212,251,30,22,189,189,157,84,239,29, 173,247,159,6,114,144,215,155,111,28,123,123,202,188,86,250, 169,19,203,156,236,205,107,133,14,134,177,146,61,117,103,236, 165,12,6,61,251,133,236,133,209,240,69,232,73,181,62,246, 254,137,231,69,150,19,116,36,26,132,18,36,102,217,37,129, 36,59,210,99,164,82,215,47,244,178,236,149,181,104,33,124, 169,47,234,56,255,191,250,254,89,55,116,79,164,151,200,108, 76,150,249,93,216,115,176,253,250,89,14,252,116,150,197,177, 247,94,68,189,86,198,90,99,25,249,78,215,255,160,47,143, 211,102,206,88,38,64,70,110,51,222,200,89,207,181,219,16, 115,47,146,29,31,81,138,120,216,241,190,73,52,38,250,171, 251,147,93,61,63,206,116,61,83,159,56,244,53,196,99,190, 117,120,133,69,131,110,251,102,170,162,66,191,11,248,107,96, 184,54,10,162,38,230,69,9,127,27,248,187,104,204,53,170, 197,106,21,229,102,231,196,164,191,77,244,240,154,177,217,168, 138,255,1,71,9,152,120, }; EmbeddedPython embedded_m5_internal_param_TaggedPrefetcher( "m5/internal/param_TaggedPrefetcher.py", "/home/hongyu/gem5-fy/build/X86_MESI_Two_Level/python/m5/internal/param_TaggedPrefetcher.py", "m5.internal.param_TaggedPrefetcher", data_m5_internal_param_TaggedPrefetcher, 2455, 7400); } // anonymous namespace
58.54386
97
0.668365
hoho20000000
ac98cb3849583db62e6c84d96b3bbb447b64167f
882
cpp
C++
common/lib/Vector/Vector.cpp
mc18g13/teensy-drone
21a396c44a32b85d6455de2743e52ba2c95bb07d
[ "MIT" ]
null
null
null
common/lib/Vector/Vector.cpp
mc18g13/teensy-drone
21a396c44a32b85d6455de2743e52ba2c95bb07d
[ "MIT" ]
null
null
null
common/lib/Vector/Vector.cpp
mc18g13/teensy-drone
21a396c44a32b85d6455de2743e52ba2c95bb07d
[ "MIT" ]
null
null
null
#include "Vector.h" #include "Quaternion.h" Vector::Vector() : v0(0), v1(0), v2(0) {} Vector::Vector(float32_t _v0, float32_t _v1, float32_t _v2) { v0 = _v0; v1 = _v1; v2 = _v2; } Vector Vector::minus(Vector v) { return Vector(v0 - v.v0, v1 - v.v1, v2 - v.v2); } Vector Vector::add(Vector v) { return Vector(v0 + v.v0, v1 + v.v1, v2 + v.v2); } Vector Vector::divide(float32_t a) { return Vector(v0 / a, v1 / a, v2 / a); } Vector Vector::multiply(float32_t a) { return Vector(v0 * a, v1 * a, v2 * a); } float32_t Vector::magnitude() { return sqrt(v0 * v0 + v1 * v1 + v2 * v2); } Vector Vector::asUnit() { float32_t inverseMagnitude = Math::fastInverseSquareRoot(v0 * v0 + v1 * v1 + v2 * v2); return Vector(v0 * inverseMagnitude, v1 * inverseMagnitude, v2 * inverseMagnitude); } Quaternion Vector::toQuaternion() { return Quaternion(0, v0, v1, v2); };
21.512195
88
0.633787
mc18g13
ac9bbc6bf15e5d7b3d39e29918a0d63392279e2b
601
hpp
C++
libs/renderer/include/sge/renderer/texture/capabilities_field_fwd.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
2
2016-01-27T13:18:14.000Z
2018-05-11T01:11:32.000Z
libs/renderer/include/sge/renderer/texture/capabilities_field_fwd.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
null
null
null
libs/renderer/include/sge/renderer/texture/capabilities_field_fwd.hpp
cpreh/spacegameengine
313a1c34160b42a5135f8223ffaa3a31bc075a01
[ "BSL-1.0" ]
3
2018-05-11T01:11:34.000Z
2021-04-24T19:47:45.000Z
// Copyright Carl Philipp Reh 2006 - 2019. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef SGE_RENDERER_TEXTURE_CAPABILITIES_FIELD_FWD_HPP_INCLUDED #define SGE_RENDERER_TEXTURE_CAPABILITIES_FIELD_FWD_HPP_INCLUDED #include <sge/renderer/texture/capabilities.hpp> #include <fcppt/container/bitfield/object_fwd.hpp> namespace sge::renderer::texture { using capabilities_field = fcppt::container::bitfield::object<sge::renderer::texture::capabilities>; } #endif
30.05
100
0.778702
cpreh
aca67d2392ee147493e0c311330e400de6ff9b5d
637
cpp
C++
patbasic/test1051.cpp
neild47/PATBasic
6215232750aa62cf406eb2a9f9c9a6d7c3850339
[ "MIT" ]
null
null
null
patbasic/test1051.cpp
neild47/PATBasic
6215232750aa62cf406eb2a9f9c9a6d7c3850339
[ "MIT" ]
null
null
null
patbasic/test1051.cpp
neild47/PATBasic
6215232750aa62cf406eb2a9f9c9a6d7c3850339
[ "MIT" ]
null
null
null
// // Created by neild47 on 18-4-28. // #include <iostream> #include <cmath> using namespace std; int test1051() { double r1, p1, r2, p2; cin >> r1 >> p1 >> r2 >> p2; double n1, n2, n3, n4; n1 = r1 * cos(p1); n2 = r1 * sin(p1); n3 = r2 * cos(p2); n4 = r2 * sin(p2); double a, b; a = n1 * n3 - n2 * n4; b = n1 * n4 + n2 * n3; if (a < 0 && a >= -0.005) { printf("0.00"); } else { printf("%.2f", a); } if (b >= 0) { printf("+%.2fi\n", b); } else if (b < 0 && b >= -0.005) { printf("+0.00i\n"); } else { printf("%.2fi\n", b); } }
18.735294
38
0.414443
neild47
aca72d628281ab6382c8fc2b5c247bd99b0ba05f
1,393
cpp
C++
Chapter5/12_image_thresholding.cpp
robotchaoX/Hands-On-GPU-Accelerated-Computer-Vision-with-OpenCV-and-CUDA
fa0c6c80e70d4dbbea8662b6f17d18927ca6d3fa
[ "MIT" ]
null
null
null
Chapter5/12_image_thresholding.cpp
robotchaoX/Hands-On-GPU-Accelerated-Computer-Vision-with-OpenCV-and-CUDA
fa0c6c80e70d4dbbea8662b6f17d18927ca6d3fa
[ "MIT" ]
null
null
null
Chapter5/12_image_thresholding.cpp
robotchaoX/Hands-On-GPU-Accelerated-Computer-Vision-with-OpenCV-and-CUDA
fa0c6c80e70d4dbbea8662b6f17d18927ca6d3fa
[ "MIT" ]
null
null
null
#include <iostream> #include "opencv2/opencv.hpp" int main(int argc, char* argv[]) { //Read Image cv::Mat h_img1 = cv::imread("images/cameraman.tif", 0); //Define device variables cv::cuda::GpuMat d_result1, d_result2, d_result3, d_result4, d_result5, d_img1; //Upload image on device d_img1.upload(h_img1); //Perform different thresholding techniques on device cv::cuda::threshold(d_img1, d_result1, 128.0, 255.0, cv::THRESH_BINARY); cv::cuda::threshold(d_img1, d_result2, 128.0, 255.0, cv::THRESH_BINARY_INV); cv::cuda::threshold(d_img1, d_result3, 128.0, 255.0, cv::THRESH_TRUNC); cv::cuda::threshold(d_img1, d_result4, 128.0, 255.0, cv::THRESH_TOZERO); cv::cuda::threshold(d_img1, d_result5, 128.0, 255.0, cv::THRESH_TOZERO_INV); //Define host variables cv::Mat h_result1, h_result2, h_result3, h_result4, h_result5; //Copy results back to host d_result1.download(h_result1); d_result2.download(h_result2); d_result3.download(h_result3); d_result4.download(h_result4); d_result5.download(h_result5); cv::imshow("Result Threshhold binary ", h_result1); cv::imshow("Result Threshhold binary inverse ", h_result2); cv::imshow("Result Threshhold truncated ", h_result3); cv::imshow("Result Threshhold truncated to zero ", h_result4); cv::imshow("Result Threshhold truncated to zero inverse ", h_result5); cv::waitKey(); return 0; }
40.970588
81
0.72649
robotchaoX
aca7fb019c97d1ff67c829f5263eaa8a1ef3ac6d
2,491
hpp
C++
Program Interface/src/interfaceDecl.hpp
Milosz08/Matrix_Calculator
0534b3bb59962312e83273a744356dc598b08a43
[ "MIT" ]
null
null
null
Program Interface/src/interfaceDecl.hpp
Milosz08/Matrix_Calculator
0534b3bb59962312e83273a744356dc598b08a43
[ "MIT" ]
null
null
null
Program Interface/src/interfaceDecl.hpp
Milosz08/Matrix_Calculator
0534b3bb59962312e83273a744356dc598b08a43
[ "MIT" ]
null
null
null
#ifndef PK_MATRIX_CALCULATOR_INTERFACEDECL_HPP #define PK_MATRIX_CALCULATOR_INTERFACEDECL_HPP #include "../../Matrix Classes/src/packages/abstractMatrixPackage/MatrixAbstract.hpp" #include "../../Matrix Classes/src/packages/generalMatrixPackage/GeneralMatrix.hpp" #include "../../Matrix Classes/src/packages/diagonalMatrixPackage/DiagonalMatrix.hpp" #include <string> #include <stdlib.h> #include <windows.h> #include <winnt.h> using namespace matrixAbstractPackage; /** @skip package klasy wirtualnej (bazowej) macierzy */ using namespace generalMatrixPackage; /** @skip package klasy pochodnej (macierze standardowa) */ using namespace diagonalMatrixPackage; /** @skip package klasy pochodnej (macierze diagonalna) */ /** @skip Deklaracje funkcji zawartych w folderze ../ProgramInterface/src */ void startPrg(); void mainMenu(HANDLE& hOut); void initMtrxObj(HANDLE& hOut); /** @skip Deklaracje funkcji zawartych w folderze ../ProgramInterface/src/initObjects */ std::string saveMtrxInfo(unsigned short int& type, unsigned short int& val); unsigned short int chooseTypeOfMatrix(HANDLE& hOut); unsigned short int chooseTypeOfNumbers(HANDLE& hOut); unsigned short int* setMtrxSize(HANDLE& hOut, unsigned short int& mtrxType, unsigned short int& mtrxValType); /** @skip Deklaracje funkcji zawartych w folderze ../ProgramInterface/src/mathOperations/mathFirstMtrx */ template<typename T> unsigned short int mathChooseMtrx(MatrixAbstract<T>* obj, HANDLE& hOut); template<typename T> void createMtrxObject(unsigned short int* sizeMtrx, HANDLE& hOut, unsigned short int& mtrxType, unsigned short int& mtrxValType); template<class M, class I, typename T> void onlyOneMtrxMath(unsigned short int& choose, MatrixAbstract<T>* ptr, M& obj, HANDLE& hOut, unsigned short int& mtrxType, unsigned short int& mtrxValType); template<class M, typename T> void onlyOneMtrxMathInfo(MatrixAbstract<T>* ptr, M& outObj, HANDLE& hOut, std::vector<std::string>infMess); /** @skip Deklaracje funkcji zawartych w folderze ../ProgramInterface/src/mathOperations/mathSecondMtrx */ template<typename T> unsigned short int mathSecondMatrix(MatrixAbstract<T>* objF, MatrixAbstract<T>* objS, HANDLE& hOut); template<class M> void secondMtrxMath(unsigned short int& choose, M& objF, M& objS, HANDLE& hOut); template<class M> void secondMtrxMathInfo(M& objF, M& objS, M& objFinal, HANDLE& hOut, std::vector<std::string>infMess); #endif
37.742424
109
0.76114
Milosz08
acaa8f2854ab19c4cb21c961c649058f418e4978
973
hpp
C++
include/experimental/fundamental/v3/contract/constexpr_assert.hpp
jwakely/std-make
f09d052983ace70cf371bb8ddf78d4f00330bccd
[ "BSL-1.0" ]
105
2015-01-24T13:26:41.000Z
2022-02-18T15:36:53.000Z
include/experimental/fundamental/v3/contract/constexpr_assert.hpp
jwakely/std-make
f09d052983ace70cf371bb8ddf78d4f00330bccd
[ "BSL-1.0" ]
37
2015-09-04T06:57:10.000Z
2021-09-09T18:01:44.000Z
include/experimental/fundamental/v3/contract/constexpr_assert.hpp
jwakely/std-make
f09d052983ace70cf371bb8ddf78d4f00330bccd
[ "BSL-1.0" ]
23
2015-01-27T11:09:18.000Z
2021-10-04T02:23:30.000Z
// Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2013,2014,2017 Vicente J. Botet Escriba #ifndef JASEL_EXPERIMENTAL_V3_CONTRACT_CONSTEXPR_ASSERT_HPP #define JASEL_EXPERIMENTAL_V3_CONTRACT_CONSTEXPR_ASSERT_HPP #include <cassert> namespace std { namespace experimental { inline namespace fundamental_v3 { namespace detail { template<class Assertion> inline void constexpr_assert_failed(Assertion a) noexcept { a(); //quick_exit(EXIT_FAILURE); } } // When evaluated at compile time emits a compilation error if condition is not true. // Invokes the standard assert at run time. #define JASEL_CONSTEXPR_ASSERT(cond) \ ((void)((cond) ? 0 : (std::experimental::detail::constexpr_assert_failed([](){ assert(false && #cond);}), 0))) } } } // namespace #endif // JASEL_EXPERIMENTAL_V3_EXPECTED_DETAIL_CONSTEXPR_UTILITY_HPP
25.605263
116
0.756423
jwakely
acb07b4c7f9f601d1e9dafbc93988ae6504cb612
247
cpp
C++
Leetcode1963.cpp
dezhonger/LeetCode
70de054be5af3a0749dce0625fefd75e176e59f4
[ "Apache-2.0" ]
1
2020-06-28T06:29:05.000Z
2020-06-28T06:29:05.000Z
Leetcode1963.cpp
dezhonger/LeetCode
70de054be5af3a0749dce0625fefd75e176e59f4
[ "Apache-2.0" ]
null
null
null
Leetcode1963.cpp
dezhonger/LeetCode
70de054be5af3a0749dce0625fefd75e176e59f4
[ "Apache-2.0" ]
null
null
null
class Solution { public: int minSwaps(string s) { int res = 0, mv = 0; for (char c : s) { if (c == '[') res++; else res--; mv = min(mv, res); } return (-mv + 1) / 2; } };
19
32
0.360324
dezhonger
acbf9d5811f274b7e3faf017cf7135a8ad794ada
6,554
hpp
C++
cpp2c/test_data/bitblock128.hpp
mendlin/SIMD-libgen
0f386bb639c829275a00f46c4b31d59c5ed84a28
[ "AFL-1.1" ]
1
2021-01-07T03:18:27.000Z
2021-01-07T03:18:27.000Z
cpp2c/test_data/bitblock128.hpp
Logicalmars/SIMD-libgen
0f386bb639c829275a00f46c4b31d59c5ed84a28
[ "AFL-1.1" ]
null
null
null
cpp2c/test_data/bitblock128.hpp
Logicalmars/SIMD-libgen
0f386bb639c829275a00f46c4b31d59c5ed84a28
[ "AFL-1.1" ]
1
2021-11-29T07:28:13.000Z
2021-11-29T07:28:13.000Z
#ifndef BITBLOCK128_HPP_ #define BITBLOCK128_HPP_ /*============================================================================= bitblock128 - Specific 128 bit IDISA implementations. Copyright (C) 2011, Robert D. Cameron, Kenneth S. Herdy, Hua Huang and Nigel Medforth. Licensed to the public under the Open Software License 3.0. Licensed to International Characters Inc. under the Academic Free License version 3.0. =============================================================================*/ #include "idisa128.hpp" #include "builtins.hpp" union ubitblock { bitblock128_t _128; uint64_t _64[sizeof(bitblock128_t)/sizeof(uint64_t)]; uint32_t _32[sizeof(bitblock128_t)/sizeof(uint32_t)]; uint16_t _16[sizeof(bitblock128_t)/sizeof(uint16_t)]; uint8_t _8[sizeof(bitblock128_t)/sizeof(uint8_t)]; }; static IDISA_ALWAYS_INLINE void add_ci_co(bitblock128_t x, bitblock128_t y, bitblock128_t carry_in, bitblock128_t & carry_out, bitblock128_t & sum); static IDISA_ALWAYS_INLINE void sub_bi_bo(bitblock128_t x, bitblock128_t y, bitblock128_t borrow_in, bitblock128_t & borrow_out, bitblock128_t & difference); static IDISA_ALWAYS_INLINE void adv_ci_co(bitblock128_t cursor, bitblock128_t carry_in, bitblock128_t & carry_out, bitblock128_t & rslt); /* The type used to store a carry bit. */ typedef bitblock128_t carry_t; static IDISA_ALWAYS_INLINE bitblock128_t carry2bitblock(carry_t carry); static IDISA_ALWAYS_INLINE carry_t bitblock2carry(bitblock128_t carry); static IDISA_ALWAYS_INLINE void adc(bitblock128_t x, bitblock128_t y, carry_t & carry, bitblock128_t & sum); static IDISA_ALWAYS_INLINE void sbb(bitblock128_t x, bitblock128_t y, carry_t & borrow, bitblock128_t & difference); static IDISA_ALWAYS_INLINE void advance_with_carry(bitblock128_t cursor, carry_t & carry, bitblock128_t & rslt); static IDISA_ALWAYS_INLINE void adc(bitblock128_t x, bitblock128_t y, carry_t carry_in, carry_t & carry_out, bitblock128_t & sum); static IDISA_ALWAYS_INLINE void sbb(bitblock128_t x, bitblock128_t y, carry_t borrow_in, carry_t & borrow_out, bitblock128_t & difference); static IDISA_ALWAYS_INLINE void advance_with_carry(bitblock128_t cursor, carry_t carry_in, carry_t & carry_out, bitblock128_t & rslt); static IDISA_ALWAYS_INLINE bitblock128_t convert (uint64_t s); static IDISA_ALWAYS_INLINE uint64_t convert (bitblock128_t v); static IDISA_ALWAYS_INLINE bitblock128_t carry2bitblock(carry_t carry) { return carry;} static IDISA_ALWAYS_INLINE carry_t bitblock2carry(bitblock128_t carry) { return carry;} static IDISA_ALWAYS_INLINE void add_ci_co(bitblock128_t x, bitblock128_t y, bitblock128_t carry_in, bitblock128_t & carry_out, bitblock128_t & sum) { bitblock128_t gen = simd_and(x, y); bitblock128_t prop = simd_or(x, y); bitblock128_t partial = simd128<64>::add(simd128<64>::add(x, y), carry_in); bitblock128_t c1 = simd128<128>::slli<64>(simd128<64>::srli<63>(simd_or(gen, simd_andc(prop, partial)))); sum = simd128<64>::add(c1, partial); carry_out = simd_or(gen, simd_andc(prop, sum)); } static IDISA_ALWAYS_INLINE void sub_bi_bo(bitblock128_t x, bitblock128_t y, bitblock128_t borrow_in, bitblock128_t & borrow_out, bitblock128_t & difference){ bitblock128_t gen = simd_andc(y, x); bitblock128_t prop = simd_not(simd_xor(x, y)); bitblock128_t partial = simd128<64>::sub(simd128<64>::sub(x, y), borrow_in); bitblock128_t b1 = simd128<128>::slli<64>(simd128<64>::srli<63>(simd_or(gen, simd_and(prop, partial)))); difference = simd128<64>::sub(partial, b1); borrow_out = simd_or(gen, simd_and(prop, difference)); } static IDISA_ALWAYS_INLINE void adv_ci_co(bitblock128_t cursor, bitblock128_t carry_in, bitblock128_t & carry_out, bitblock128_t & rslt){ bitblock128_t shift_out = simd128<64>::srli<63>(cursor); bitblock128_t low_bits = esimd128<64>::mergel(shift_out, carry_in); carry_out = cursor; rslt = simd_or(simd128<64>::add(cursor, cursor), low_bits); } IDISA_ALWAYS_INLINE void adc(bitblock128_t x, bitblock128_t y, carry_t & carry, bitblock128_t & sum) { bitblock128_t gen = simd_and(x, y); bitblock128_t prop = simd_or(x, y); bitblock128_t partial = simd128<64>::add(simd128<64>::add(x, y), carry2bitblock(carry)); bitblock128_t c1 = simd128<128>::slli<64>(simd128<64>::srli<63>(simd_or(gen, simd_andc(prop, partial)))); sum = simd128<64>::add(c1, partial); carry = bitblock2carry(simd128<128>::srli<127>(simd_or(gen, simd_andc(prop, sum)))); } IDISA_ALWAYS_INLINE void adc(bitblock128_t x, bitblock128_t y, carry_t carry_in, carry_t & carry_out, bitblock128_t & sum) { bitblock128_t co; add_ci_co(x, y, carry2bitblock(carry_in), co, sum); carry_out = bitblock2carry(simd128<128>::srli<127>(co)); } IDISA_ALWAYS_INLINE void sbb(bitblock128_t x, bitblock128_t y, carry_t & borrow, bitblock128_t & difference) { bitblock128_t gen = simd_andc(y, x); bitblock128_t prop = simd_not(simd_xor(x, y)); bitblock128_t partial = simd128<64>::sub(simd128<64>::sub(x, y), carry2bitblock(borrow)); bitblock128_t b1 = simd128<128>::slli<64>(simd128<64>::srli<63>(simd_or(gen, simd_and(prop, partial)))); difference = simd128<64>::sub(partial, b1); borrow = bitblock2carry(simd128<128>::srli<127>(simd_or(gen, simd_and(prop, difference)))); } IDISA_ALWAYS_INLINE void sbb(bitblock128_t x, bitblock128_t y, carry_t borrow_in, carry_t & borrow_out, bitblock128_t & difference) { bitblock128_t bo; sub_bi_bo(x, y, carry2bitblock(borrow_in), bo, difference); borrow_out = bitblock2carry(simd128<128>::srli<127>(bo)); } IDISA_ALWAYS_INLINE void advance_with_carry(bitblock128_t cursor, carry_t & carry, bitblock128_t & rslt) { bitblock128_t shift_out = simd128<64>::srli<63>(cursor); bitblock128_t low_bits = esimd128<64>::mergel(shift_out, carry2bitblock(carry)); carry = bitblock2carry(simd128<128>::srli<64>(shift_out)); rslt = simd_or(simd128<64>::add(cursor, cursor), low_bits); } IDISA_ALWAYS_INLINE void advance_with_carry(bitblock128_t cursor, carry_t carry_in, carry_t & carry_out, bitblock128_t & rslt) { bitblock128_t shift_out = simd128<64>::srli<63>(cursor); bitblock128_t low_bits = esimd128<64>::mergel(shift_out, carry2bitblock(carry_in)); carry_out = bitblock2carry(simd128<128>::srli<64>(shift_out)); rslt = simd_or(simd128<64>::add(cursor, cursor), low_bits); } IDISA_ALWAYS_INLINE bitblock128_t convert(uint64_t s) { ubitblock b; b._128 = simd128<128>::constant<0>(); b._64[0] = s; return b._128; } IDISA_ALWAYS_INLINE uint64_t convert (bitblock128_t v) { return (uint64_t) mvmd128<64>::extract<0>(v); } #endif // BITBLOCK128_HPP_
46.15493
157
0.753891
mendlin
accabed9773495b37cc003cdcb3ede1ddc826818
1,903
cpp
C++
server/Server.cpp
MohamedAshrafTolba/http-client-server
3776f1a5ff1921564d6c288be0ba870dbdacce22
[ "MIT" ]
null
null
null
server/Server.cpp
MohamedAshrafTolba/http-client-server
3776f1a5ff1921564d6c288be0ba870dbdacce22
[ "MIT" ]
null
null
null
server/Server.cpp
MohamedAshrafTolba/http-client-server
3776f1a5ff1921564d6c288be0ba870dbdacce22
[ "MIT" ]
null
null
null
#include "Server.h" #include <cmath> #include <iostream> Server::Server(std::string &port_number, unsigned short backlog, unsigned long max_workers) { this->port_number = port_number; this->backlog = backlog; this->max_workers = max_workers; server_socket = new ServerSocket(port_number, backlog); } Server::~Server() { delete(server_socket); } void Server::run() { std::string http_version(HTTP_VERSION); std::mutex pool_mutex; auto f = [&] { while (true) { std::this_thread::sleep_for(std::chrono::seconds(5)); pool_mutex.lock(); for (auto it = workers_pool.begin(); it < workers_pool.end();) { HttpWorkerThread *worker = *it; if (worker != nullptr && worker->is_done()) { delete worker; it = workers_pool.erase(it); } else { it++; } } pool_mutex.unlock(); } }; std::thread gc(f); while (true) { while (workers_pool.size() >= max_workers) { sleep(2); } int connecting_socket_fd = server_socket->accept_connection(); if (connecting_socket_fd == -1) { // Error } int timeout = TIMEOUT - floor(0.01 * TIMEOUT * workers_pool.size()); HttpWorkerThread *worker = new HttpWorkerThread(connecting_socket_fd, http_version, timeout); pool_mutex.lock(); workers_pool.push_back(worker); pool_mutex.unlock(); } gc.join(); } std::string Server::get_port_number() const { return port_number; } unsigned short Server::get_backlog() const { return backlog; } unsigned long Server::get_max_workers() const { return max_workers; } int Server::get_server_socket_fd() const { return server_socket->get_socket_fd(); }
25.373333
101
0.576458
MohamedAshrafTolba
accfbbce45432c9ac4235b5c5cbb6a3ed224148d
9,908
cpp
C++
src/sc.cpp
josephnoir/indexing
99f6a02c22451d0db204731a6c53ed56ad751365
[ "BSD-3-Clause" ]
5
2017-01-30T17:02:24.000Z
2017-04-22T04:20:41.000Z
src/sc.cpp
josephnoir/indexing
99f6a02c22451d0db204731a6c53ed56ad751365
[ "BSD-3-Clause" ]
null
null
null
src/sc.cpp
josephnoir/indexing
99f6a02c22451d0db204731a6c53ed56ad751365
[ "BSD-3-Clause" ]
null
null
null
/****************************************************************************** * Copyright (C) 2017 * * Raphael Hiesgen <raphael.hiesgen (at) haw-hamburg.de> * * * * Distributed under the terms and conditions of the BSD 3-Clause License. * * * * If you did not receive a copy of the license files, see * * http://opensource.org/licenses/BSD-3-Clause and * ******************************************************************************/ #include <cmath> #include <tuple> #include <chrono> #include <limits> #include <random> #include <vector> #include <cassert> #include <cstring> #include <fstream> #include <iomanip> #include <numeric> #include <sstream> #include <iomanip> #include <iostream> #include <iterator> #include <algorithm> #include <unordered_map> #include "caf/all.hpp" #include "caf/opencl/all.hpp" using namespace std; using namespace std::chrono; using namespace caf; using namespace caf::opencl; // required to allow sending mem_ref<int> in messages namespace caf { template <> struct allowed_unsafe_message_type<mem_ref<uint32_t>> : std::true_type {}; template <> struct allowed_unsafe_message_type<opencl::dim_vec> : std::true_type {}; template <> struct allowed_unsafe_message_type<nd_range> : std::true_type {}; } namespace { using uval = uint32_t; using uvec = std::vector<uval>; using uref = mem_ref<uval>; /*****************************************************************************\ JUST FOR STUFF \*****************************************************************************/ template <class T, class E = typename enable_if<is_integral<T>::value>::type> T round_up(T numToRound, T multiple) { assert(multiple > 0); return ((numToRound + multiple - 1) / multiple) * multiple; } template <class T, typename std::enable_if<is_integral<T>{}, int>::type = 0> uval as_uval(T val) { return static_cast<uval>(val); } template <class T> vector<T> compact(vector<T> values, vector<T> heads) { assert(values.size() == heads.size()); vector<T> result; auto res_size = count(begin(heads), end(heads), 1u); result.reserve(res_size); for (size_t i = 0; i < values.size(); ++i) { if (heads[i] == 1) result.emplace_back(values[i]); } return result; } /*****************************************************************************\ INTRODUCE SOME CLI ARGUMENTS \*****************************************************************************/ class config : public actor_system_config { public: size_t iterations = 1000; size_t threshold = 1500; string filename = ""; uval bound = 0; string device_name = "GeForce GTX 780M"; bool print_results; double frequency = 0.01; config() { load<opencl::manager>(); opt_group{custom_options_, "global"} .add(filename, "data-file,f", "file with test data (one value per line)") .add(bound, "bound,b", "maximum value (0 will scan values)") .add(device_name, "device,d", "device for computation (GeForce GTX 780M, " "empty string will take first available device)") .add(print_results, "print,p", "print resulting bitmap index") .add(threshold, "threshold,t", "Threshold for output (1500)") .add(iterations, "iterations,i", "Number of times the empty kernel is supposed to run (1000)") .add(frequency, "frequency,F", "Frequency of 1 in the heads array.(0.1)"); } }; } // namespace <anonymous> /*****************************************************************************\ MAIN! \*****************************************************************************/ void caf_main(actor_system& system, const config& cfg) { uvec values; uvec heads; random_device rd; //Will be used to obtain a seed for the random number engine mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd() uniform_int_distribution<size_t> s_gen(1, 100); uniform_int_distribution<size_t> v_gen(1, numeric_limits<uint16_t>::max()); bernoulli_distribution h_gen(cfg.frequency); // ---- get data ---- if (cfg.filename.empty()) { auto size = s_gen(gen) * 1048576 + s_gen(gen); cout << "Compacting " << size << " values." << endl; values.reserve(size); for (size_t i = 0; i < size; ++i) values.emplace_back(v_gen(gen)); } else { ifstream source{cfg.filename, std::ios::in}; uval next; while (source >> next) { values.push_back(next); } } heads.reserve(values.size()); heads.emplace_back(1); for (size_t i = 1; i < values.size(); ++i) heads.emplace_back(h_gen(gen) ? 1 : 0); // ---- get device ---- auto& mngr = system.opencl_manager(); auto opt = mngr.find_device_if([&](const device_ptr dev) { if (cfg.device_name.empty()) return true; return dev->name() == cfg.device_name; }); if (!opt) { opt = mngr.find_device_if([&](const device_ptr) { return true; }); if (!opt) { cout << "No device found." << endl; return; } cerr << "Using device '" << (*opt)->name() << "'." << endl; } // ---- general ---- auto dev = move(*opt); auto prog_es = mngr.create_program_from_file("./include/scan.cl", "", dev); auto prog_sc = mngr.create_program_from_file("./include/stream_compaction.cl", "", dev); { // ---- funcs ---- auto half_block = dev->max_work_group_size() / 2; auto get_size = [half_block](size_t n) -> size_t { return round_up((n + 1) / 2, half_block); }; auto half_size_for = [](size_t n, size_t block) -> size_t { return round_up((n + 1) / 2, block); }; auto reduced_scan = [&](const uref&, uval n) { // calculate number of groups from the group size from the values size return size_t{get_size(n) / half_block}; }; auto ndr_scan = [half_size_for, half_block](size_t dim) { return nd_range{dim_vec{half_size_for(dim,half_block)}, {}, dim_vec{half_block}}; }; auto ndr_compact = [](uval dim) { return nd_range{dim_vec{round_up(dim, 128u)}, {}, dim_vec{128}}; }; auto reduced_compact = [](const uref&, uval n) { return size_t{round_up(n, 128u) / 128u}; }; auto one = [](uref&, uref&, uref&, uval) { return size_t{1}; }; auto k_compact = [](uref&, uref&, uref&, uval k) { return size_t{k}; }; // spawn arguments auto ndr = nd_range{dim_vec{half_block}, {}, dim_vec{half_block}}; // actors // exclusive scan auto scan1 = mngr.spawn( prog_es, "es_phase_1", ndr, [ndr_scan](nd_range& range, message& msg) -> optional<message> { msg.apply([&](const uref&, uval n) { range = ndr_scan(n); }); return std::move(msg); }, in_out<uval, mref, mref>{}, out<uval,mref>{reduced_scan}, local<uval>{half_block * 2}, priv<uval, val>{} ); auto scan2 = mngr.spawn( prog_es, "es_phase_2", nd_range{dim_vec{half_block}, {}, dim_vec{half_block}}, in_out<uval,mref,mref>{}, in_out<uval,mref,mref>{}, priv<uval, val>{} ); auto scan3 = mngr.spawn( prog_es, "es_phase_3", ndr, [ndr_scan](nd_range& range, message& msg) -> optional<message> { msg.apply([&](const uref&, const uref&, uval n) { range = ndr_scan(n); }); return std::move(msg); }, in_out<uval,mref,mref>{}, in<uval,mref>{}, priv<uval, val>{} ); // stream compaction auto sc_count = mngr.spawn( prog_sc,"countElts", ndr, [ndr_compact](nd_range& range, message& msg) -> optional<message> { msg.apply([&](const uref&, uval n) { range = ndr_compact(n); }); return std::move(msg); }, out<uval,mref>{reduced_compact}, in_out<uval,mref,mref>{}, local<uval>{128}, priv<uval,val>{} ); // --> sum operation is handled by es actors belows (exclusive scan) auto sc_move = mngr.spawn( prog_sc, "moveValidElementsStaged", ndr, [ndr_compact](nd_range& range, message& msg) -> optional<message> { msg.apply([&](const uref&, const uref&, const uref&, uval n) { range = ndr_compact(n); }); return std::move(msg); }, out<uval,mref>{one}, in_out<uval,mref,mref>{}, out<uval,mref>{k_compact}, in_out<uval,mref,mref>{}, in_out<uval,mref,mref>{}, local<uval>{128}, local<uval>{128}, local<uval>{128}, priv<uval,val>{} ); auto values_r = dev->global_argument(values); auto heads_r = dev->global_argument(heads); auto expected = compact(values, heads); uref data_r; // computations scoped_actor self{system}; self->send(sc_count, heads_r, as_uval(heads_r.size())); self->receive([&](uref& blocks, uref& heads) { self->send(scan1, blocks, as_uval(blocks.size())); heads_r = heads; }); self->receive([&](uref& data, uref& incs) { self->send(scan2, data, incs, as_uval(incs.size())); }); self->receive([&](uref& data, uref& incs) { self->send(scan3, data, incs, as_uval(data.size())); }); self->receive([&](uref& results) { self->send(sc_move, values_r, heads_r, results, as_uval(values_r.size())); }); self->receive([&](uref& size, uref&, uref& data, uref&, uref&) { auto size_exp = size.data(); auto num = (*size_exp)[0]; auto exp = data.data(num); auto actual = std::move(*exp); cout << (expected != actual ? "FAILURE" : "SUCCESS") << endl; }); } // clean up system.await_all_actors_done(); } CAF_MAIN()
34.643357
98
0.552382
josephnoir
acd046ee059426ae791159e5ed3a53fd19cfc83e
3,632
cpp
C++
dp/sg/ui/manipulator/src/FlightCameraManipulatorHIDSync.cpp
asuessenbach/pipeline
2e49968cc3b9948a57f7ee6c4cc3258925c92ab2
[ "BSD-3-Clause" ]
217
2015-01-06T09:26:53.000Z
2022-03-23T14:03:18.000Z
dp/sg/ui/manipulator/src/FlightCameraManipulatorHIDSync.cpp
asuessenbach/pipeline
2e49968cc3b9948a57f7ee6c4cc3258925c92ab2
[ "BSD-3-Clause" ]
10
2015-01-25T12:42:05.000Z
2017-11-28T16:10:16.000Z
dp/sg/ui/manipulator/src/FlightCameraManipulatorHIDSync.cpp
asuessenbach/pipeline
2e49968cc3b9948a57f7ee6c4cc3258925c92ab2
[ "BSD-3-Clause" ]
44
2015-01-13T01:19:41.000Z
2022-02-21T21:35:08.000Z
// Copyright NVIDIA Corporation 2010 // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of NVIDIA CORPORATION nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <dp/sg/ui/manipulator/FlightCameraManipulatorHIDSync.h> namespace dp { namespace sg { namespace ui { namespace manipulator { FlightCameraManipulatorHIDSync::FlightCameraManipulatorHIDSync( const dp::math::Vec2f & sensitivity ) : FlightCameraManipulator( sensitivity ) , PID_Pos(0) , PID_Wheel(0) , PID_Forward(0) , PID_Reverse(0) , m_speed(1.f) { } FlightCameraManipulatorHIDSync::~FlightCameraManipulatorHIDSync() { } bool FlightCameraManipulatorHIDSync::updateFrame( float dt ) { if (!m_hid) { return false; } setCursorPosition( m_hid->getValue<dp::math::Vec2i>( PID_Pos ) ); setWheelTicks( m_hid->getValue<int>( PID_Wheel ) ); bool forward = m_hid->getValue<bool>( PID_Forward ); bool reverse = m_hid->getValue<bool>( PID_Reverse ); // set speed based on wheel and buttons m_speed += getWheelTicksDelta() * 0.1f; if( m_speed < 0.f ) { m_speed = 0.f; } if( forward || reverse ) { // set forward, reverse here FlightCameraManipulator::setSpeed( forward ? m_speed : -m_speed ); } else { // stopped FlightCameraManipulator::setSpeed( 0.f ); } return FlightCameraManipulator::updateFrame( dt ); } void FlightCameraManipulatorHIDSync::setHID( HumanInterfaceDevice *hid ) { m_hid = hid; PID_Pos = m_hid->getProperty( "Mouse_Position" ); PID_Forward = m_hid->getProperty( "Mouse_Left" ); PID_Reverse = m_hid->getProperty( "Mouse_Middle" ); PID_Wheel = m_hid->getProperty( "Mouse_Wheel" ); } } // namespace manipulator } // namespace ui } // namespace sg } // namespace dp
35.960396
110
0.627753
asuessenbach
acd1919f833609fcc07594346191cfa8d2f00d16
2,156
cpp
C++
examples/gestures/Canvas.cpp
WearableComputerLab/LibWCL
e1687a8fd2f96bfec3a84221044cfb8b7126a79c
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
examples/gestures/Canvas.cpp
WearableComputerLab/LibWCL
e1687a8fd2f96bfec3a84221044cfb8b7126a79c
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
examples/gestures/Canvas.cpp
WearableComputerLab/LibWCL
e1687a8fd2f96bfec3a84221044cfb8b7126a79c
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
/** * A Gesture Recognition system in C++ * This library is based on the following paper: * * Wobbrock, J, Wilson, A, Li, Y 2007 * Gestures without Libraries, Toolkits or Training: * A $1 Recognizer for User Interface Prototypes * UIST 2007 * * @author Michael Marner ([email protected]) */ #include "Canvas.h" #include "GestureIO.h" #include <QPainter> using namespace wcl; Canvas::Canvas() { recording = false; tracking = false; } void Canvas::mousePressEvent(QMouseEvent *event) { qDebug("mousePressed"); tracking = true; } void Canvas::mouseReleaseEvent(QMouseEvent *event) { qDebug("mouseReleased"); tracking = false; //prepare the pointlist that we just recorded PointList points = gEngine.prepare(lineList); qDebug("have prepared the points"); if (recording) { //save gesture if (gestureName != "") { gIO.saveGesture(points, gestureName.toAscii().constData()); gEngine.addTemplate(points, gestureName.toAscii().constData()); } recording = false; emit gestureRecognised(""); } else { //recognise gesture std::string gesture = gEngine.recognise(points); emit gestureRecognised(QString(gesture.c_str())); qDebug("%s",gesture.c_str()); } //clear our line list and repaint lineList.clear(); this->repaint(); } void Canvas::mouseMoveEvent(QMouseEvent *event) { //if we are currently tracking, push the current mouse location onto //our linelist if (tracking) { lineList.push_back(Point(event->x(), event->y())); this->repaint(); } } void Canvas::paintEvent(QPaintEvent *event) { /* * Draw each line that we currently have */ if (lineList.size() > 0) { QPainter p(this); PointList::iterator it = lineList.begin(); Point first = *it; it++; for (;it<lineList.end();it++) { Point p2 = *it; p.drawLine(first[0], first[1], p2[0], p2[1]); first = p2; } } } void Canvas::startRecording() { this->recording = true; //This is a hack to get the status bar to display when we are //recording. Really this should be a different signal. emit gestureRecognised("RECORDING"); } void Canvas::setGestureName(QString name) { this->gestureName = name; }
19.779817
69
0.684601
WearableComputerLab
acd40d0d2213ae5664925e8dbc79e1e387a18863
1,396
cpp
C++
Plugins/GStreamer/Source/GStreamer/Private/GStreamerModule.cpp
kevinrev26/UnrealGAMS
74b53f5d0e52bd8826e5991192a62cc04547d93e
[ "BSD-3-Clause" ]
7
2019-02-19T23:28:25.000Z
2021-09-06T16:23:49.000Z
Plugins/GStreamer/Source/GStreamer/Private/GStreamerModule.cpp
kevinrev26/UnrealGAMS
74b53f5d0e52bd8826e5991192a62cc04547d93e
[ "BSD-3-Clause" ]
1
2019-02-19T21:46:07.000Z
2019-02-19T21:46:07.000Z
Plugins/GStreamer/Source/GStreamer/Private/GStreamerModule.cpp
racsoraul/UnrealGAMS
3931d6d45ddc7aed7acf941740bd60250e9db196
[ "BSD-3-Clause" ]
8
2019-02-18T18:00:25.000Z
2019-07-12T19:33:36.000Z
#include "GStreamerModule.h" #include "GstCoreImpl.h" #include "SharedUnreal.h" #include "Runtime/Core/Public/Misc/Paths.h" class FGStreamerModule : public IGStreamerModule { public: virtual void StartupModule() override; virtual void ShutdownModule() override; }; DEFINE_LOG_CATEGORY(LogGStreamer); static FString GetGstRoot() { const int32 BufSize = 2048; TCHAR RootPath[BufSize] = {0}; FPlatformMisc::GetEnvironmentVariable(TEXT("GSTREAMER_ROOT_X86_64"), RootPath, BufSize); if (!RootPath[0]) { FPlatformMisc::GetEnvironmentVariable(TEXT("GSTREAMER_ROOT"), RootPath, BufSize); } return FString(RootPath); } void FGStreamerModule::StartupModule() { GST_LOG_DBG(TEXT("StartupModule")); INIT_PROFILER; FString RootPath = GetGstRoot(); FString BinPath = FPaths::Combine(RootPath, TEXT("bin")); FString PluginPath = FPaths::Combine(RootPath, TEXT("lib"), TEXT("gstreamer-1.0")); GST_LOG_DBG(TEXT("GStreamer: GSTREAMER_ROOT=\"%s\""), *RootPath); if (FGstCoreImpl::Init(TCHAR_TO_ANSI(*BinPath), TCHAR_TO_ANSI(*PluginPath))) { GST_LOG_DBG(TEXT("GStreamer: Init SUCCESS")); } else { GST_LOG_ERR(TEXT("GStreamer: Init FAILED")); } } void FGStreamerModule::ShutdownModule() { GST_LOG_DBG(TEXT("ShutdownModule")); FGstCoreImpl::Deinit(); SHUT_PROFILER; } IMPLEMENT_MODULE(FGStreamerModule, GStreamer)
22.885246
90
0.7149
kevinrev26
acdc41f45d220f0e49dc58fbee296d41adf55335
363
hpp
C++
dialogs/loadMenu/dialogs.hpp
Kortonki/antistasi_remastered
11c005467d8efb7c709621c00d9b16ae1a5f3be2
[ "BSD-3-Clause" ]
null
null
null
dialogs/loadMenu/dialogs.hpp
Kortonki/antistasi_remastered
11c005467d8efb7c709621c00d9b16ae1a5f3be2
[ "BSD-3-Clause" ]
26
2020-05-15T14:38:08.000Z
2021-06-28T18:26:53.000Z
dialogs/loadMenu/dialogs.hpp
Kortonki/antistasi_remastered
11c005467d8efb7c709621c00d9b16ae1a5f3be2
[ "BSD-3-Clause" ]
null
null
null
class AS_loadMenu { idd=1601; movingenable=false; class controls { AS_DIALOG(5,"Load game", "[] spawn AS_fnc_UI_loadMenu_close;"); LIST_L(0,1,0,4,""); BTN_L(5,-1,"Delete selected", "Delete the selected saved game", "[] spawn AS_fnc_UI_loadMenu_delete;"); BTN_R(5,-1,"Load game", "Load the selected saved game", "[] spawn AS_fnc_UI_loadMenu_load;"); }; };
22.6875
103
0.699725
Kortonki
acdf0c5876147daab059a3e5bcb48643137dc070
958
cpp
C++
Userland/Demos/ModelGallery/main.cpp
TheCrott/serenity
925f21353efaa5304c5d486e6802c4e75e0c4d15
[ "BSD-2-Clause" ]
650
2019-03-01T13:33:03.000Z
2022-03-15T09:26:44.000Z
Userland/Demos/ModelGallery/main.cpp
TheCrott/serenity
925f21353efaa5304c5d486e6802c4e75e0c4d15
[ "BSD-2-Clause" ]
51
2019-04-03T08:32:38.000Z
2019-05-19T13:44:28.000Z
Userland/Demos/ModelGallery/main.cpp
TheCrott/serenity
925f21353efaa5304c5d486e6802c4e75e0c4d15
[ "BSD-2-Clause" ]
33
2019-03-26T05:47:59.000Z
2021-11-22T18:18:45.000Z
/* * Copyright (c) 2021, sin-ack <[email protected]> * * SPDX-License-Identifier: BSD-2-Clause */ #include "GalleryWidget.h" #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/Button.h> #include <LibGUI/Frame.h> #include <LibGUI/MessageBox.h> #include <unistd.h> int main(int argc, char** argv) { if (pledge("stdio recvfd sendfd rpath wpath cpath unix", nullptr) < 0) { perror("pledge"); return 1; } auto app = GUI::Application::construct(argc, argv); if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) { perror("pledge"); return 1; } auto app_icon = GUI::Icon::default_icon("app-model-gallery"); auto window = GUI::Window::construct(); window->set_title("Model Gallery"); window->set_icon(app_icon.bitmap_for_size(16)); window->resize(430, 480); window->set_main_widget<GalleryWidget>(); window->show(); return app->exec(); }
23.95
76
0.646138
TheCrott
acdfb7986a63e425ad08820c50aa0b34dbb63dac
28,026
cpp
C++
docs/simple.cpp
ief015/libfada
97dc34a96fd3a6fb454680303229b6295ef3d28a
[ "Zlib" ]
null
null
null
docs/simple.cpp
ief015/libfada
97dc34a96fd3a6fb454680303229b6295ef3d28a
[ "Zlib" ]
null
null
null
docs/simple.cpp
ief015/libfada
97dc34a96fd3a6fb454680303229b6295ef3d28a
[ "Zlib" ]
null
null
null
/*********************************************************** ** libfada Full Example Visualizer ** Written by Nathan Cousins - December 2013 ** ** Usage: full_visualizer <audio_filepath> ** `audio_filepath' may be any filetype supported by SFML/libsndfile. ***********************************************************/ ////////////////////////////////////////////////// // Includes ////////////////////////////////////////////////// #include <stdio.h> #include <string> #include <vector> #include <SFML/Audio.hpp> #include <SFML/Graphics.hpp> #include <fada/fada.hpp> #if defined(_WIN32) || defined(__WIN32__) #include <Windows.h> #include <Shlwapi.h> #ifndef _WINDOWS_ #define _WINDOWS_ #endif #endif ////////////////////////////////////////////////// // Declarations ////////////////////////////////////////////////// class AudioAnalyzer; class AudioFileStream; sf::RenderWindow* rw = NULL; AudioFileStream* audio = NULL; sf::Time continueInterval, nextContinue; bool isRunning; sf::Mutex mutex; const unsigned WINDOW_BUFFER_SIZE = 2048; const unsigned FFT_BUFFER_SIZE = WINDOW_BUFFER_SIZE * 2; fada_Res resultBuffer[WINDOW_BUFFER_SIZE]; sf::CircleShape orbBeat, orbBass; sf::VertexArray vertexArray; struct FreqBar { fada_Res value; double linePos, lineVel; }; const unsigned NUM_FREQBARS = 12; FreqBar freqBars[NUM_FREQBARS]; enum { DRAW_NONE, DRAW_FFT, DRAW_WAVEFORM, DRAW_FFT_MIXED, DRAW_WAVEFORM_MIXED } drawMode; bool showSubBands; bool showOrbs; bool debugMode; double debugFPS, debugMS; sf::Font* fontDebug; sf::Text txtDebug; bool mouseHoverProgressBar; // Application loop sub-routines. bool initialize(const std::string& filename); void finish(); void processEvents(); void tick(float ms); void render(); // Utility functions. fada_Res calcFreqBar(fada_Pos start, fada_Pos end); // User events. void onMouseDown(int x, int y, unsigned b); void onMouseUp(int x, int y, unsigned b); void onMouseWheel(int x, int y, int d); void onMouseMove(int x, int y, int dx, int dy); void onKeyDown(int key); void onKeyUp(int key); void onWindowResize(unsigned w, unsigned h); void onWindowClose(); // Logging functions. void logMessage(const char* func, const char* fmt, ...); void logWarning(const char* func, const char* fmt, ...); void logError(const char* func, const char* fmt, ...); // FADA error checking. fada_Error checkFADA(unsigned int line, fada_Error err); #ifndef NDEBUG #define CHECK_FADA(x) checkFADA(__LINE__, (x)) #else #define CHECK_FADA(x) (x) #endif // Base class for audio analyzation via libfada. class AudioAnalyzer { private: bool m_fadaLoaded; fada_Res m_beat, m_bass, m_normal; protected: std::vector<fada_FFTBuffer*> m_buffers; fada_FFTBuffer* m_mixedBuffer; fada_Manager* m_fada; void setup(unsigned int sampleRate, unsigned int channelCount) { fada_Error err; m_fadaLoaded = false; // Set up our FADA manager. err = CHECK_FADA(fada_bindstream(m_fada, FADA_TSAMPLE_INT16, sampleRate, channelCount)); if (err != FADA_ERROR_SUCCESS) { logError("AudioFileStream::onGetData", "could not initialize stream (manager=0x%p, rate=%d, channels=%d, error=%d)\n", m_fada, sampleRate, channelCount, err); return; } // Set up the analyzation window to 2048 frames. err = CHECK_FADA(fada_setwindowframes(m_fada, WINDOW_BUFFER_SIZE)); if (err != FADA_ERROR_SUCCESS) { logWarning("AudioFileStream::onGetData", "could not set window size to 2048 (manager=0x%p, error=%d)\n", m_fada, err); } // Close any current buffers before making new ones. this->closeBuffers(); // Set up FFT buffers. for (unsigned int i = 0; i < channelCount; ++i) { m_buffers.push_back(fada_newfftbuffer(FFT_BUFFER_SIZE)); } m_mixedBuffer = fada_newfftbuffer(FFT_BUFFER_SIZE); m_normal = fada_getnormalizer(m_fada); m_fadaLoaded = true; } void closeBuffers() { // Close buffers. if (m_mixedBuffer) fada_closefftbuffer(m_mixedBuffer); m_mixedBuffer = NULL; for (size_t i = 0, sz = m_buffers.size(); i < sz; ++i) fada_closefftbuffer(m_buffers[i]); m_buffers.clear(); // For added security, tell the manager that no FFT buffer is in use. CHECK_FADA(fada_usefftbuffer(m_fada, NULL)); } public: AudioAnalyzer() { m_fadaLoaded = false; m_beat = 0.; m_bass = 0.; m_normal = 1.; m_mixedBuffer = NULL; m_fada = fada_newmanager(); } virtual ~AudioAnalyzer() { // Close our FFT buffers. this->closeBuffers(); // Close manager. fada_closemanager(m_fada); } bool isReady() const { return m_fadaLoaded; } fada_Error pushSamples(const sf::Int16* samples, size_t sampleCount) { // Remove old sample data from the manager. fada_trimchunks(m_fada); // Push a new chunk of samples into the manager. return CHECK_FADA(fada_pushsamples(m_fada, (void*)samples, sampleCount, FADA_TRUE)); } void update() { if (!m_fadaLoaded) return; // Calculate beat and audible bass. CHECK_FADA(fada_calcbeat(m_fada, &m_beat)); m_beat /= m_normal; CHECK_FADA(fada_calcbass(m_fada, &m_bass)); m_bass /= m_normal; // Generate a mixed FFT on the mixed buffer. CHECK_FADA(fada_usefftbuffer(m_fada, m_mixedBuffer)); CHECK_FADA(fada_calcfft(m_fada)); // Generate a channel-specific FFT on each buffer. for (size_t i = 0, sz = m_buffers.size(); i < sz; ++i) { CHECK_FADA(fada_usefftbuffer(m_fada, m_buffers[i])); CHECK_FADA(fada_calcfft_channel(m_fada, i)); } } bool advance(long advanceFrames = FADA_NEXT_WINDOW) { return fada_continue(m_fada, advanceFrames) == FADA_TRUE; } fada_Res getBeat() const { return m_beat; } fada_Res getBass() const { return m_bass; } fada_Res getFFTValue(fada_Pos pos) const { // Get FFT value. fada_Res res; CHECK_FADA(fada_getfftvalue(m_fada, pos, &res)); return res; } void getFFTValues(fada_Res* out, fada_Pos offset = 0, fada_Pos length = 0) { // Get all FFT values. if (offset == 0 && length == 0) CHECK_FADA(fada_getfftvalues(m_fada, out)); // Get all `length' FFT values starting from offset. else CHECK_FADA(fada_getfftvaluesrange(m_fada, out, offset, length)); } const fada_Res getNormal() const { return m_normal; } void useFFTBuffer(unsigned int channel) { if (channel >= m_buffers.size()) { logWarning("AudioAnalyzer::useFFTBuffer", "invalid channel selected, must be below buffer count (manager=0x%p, channel=%d, buffers=%d)\n", m_fada, channel, m_buffers.size()); return; } // Use this buffer for grabbing values from getFFTValue() CHECK_FADA(fada_usefftbuffer(m_fada, m_buffers[channel])); } void useFFTMixedBuffer() { // Use the mixed buffer for grabbing values from getFFTValue() CHECK_FADA(fada_usefftbuffer(m_fada, m_mixedBuffer)); } fada_Manager* getManager() { return m_fada; } const fada_Manager* getManager() const { return m_fada; } }; // Used for streaming an audio file, using SFML's Music class to stream sample chunks. class AudioFileStream : public sf::Music, public AudioAnalyzer { protected: virtual void onSeek(sf::Time timeOffset) { //sf::Lock lock(mutex); sf::Music::onSeek(timeOffset); logMessage("AudioFileStream::onSeek", "seeking... (sec=%.2f)\n", timeOffset.asSeconds()); fada_freechunks(m_fada); } virtual bool onGetData(sf::SoundStream::Chunk& chunk) { fada_Error err; if (sf::Music::onGetData(chunk)) { sf::Lock lock(mutex); // Is this our first chunk? // Also make sure that audio information is still valid. This may change when changing audio sources. if (!this->isReady() || fada_getchannels(m_fada) != this->getChannelCount() || fada_getsamplerate(m_fada) != this->getSampleRate() ) { this->setup(this->getSampleRate(), this->getChannelCount()); } err = this->pushSamples(chunk.samples, chunk.sampleCount); if (err != FADA_ERROR_SUCCESS) logError("AudioFileStream::onGetData", "could not push samples (chunk=0x%p, count=%d, error=%d)\n", chunk.samples, chunk.sampleCount, err); return true; } return false; } }; ////////////////////////////////////////////////// // Definitions ////////////////////////////////////////////////// ////////////////////////////////////////////////// int main(int argc, char* args[]) { const float TICKRATE = 1.f/60; std::string filename = ""; if (argc > 1) filename = args[1]; isRunning = initialize(filename); if (!isRunning) return 1; sf::Clock clkFPS = sf::Clock(); sf::Clock clkMS = sf::Clock(); sf::Clock clk = sf::Clock(); sf::Time clkTime; do { processEvents(); while ((clkTime += clk.restart()) >= sf::seconds(TICKRATE)) { clkMS.restart(); clkTime -= sf::seconds(TICKRATE); tick(TICKRATE*1000.f); debugMS = clkMS.getElapsedTime().asMicroseconds() / 1000.; } render(); debugFPS = 1000. / (clkFPS.restart().asMicroseconds() / 1000.); sf::sleep(sf::milliseconds(1)); } while (isRunning); finish(); return 0; } ////////////////////////////////////////////////// bool initialize(const std::string& filename) { sf::Lock lock(mutex); std::string title = "Example libfada Visualizer"; #ifdef _WINDOWS_ // Force application to use root executable directory on Windows. { char strPath[MAX_PATH]; GetModuleFileName(NULL, strPath, MAX_PATH); std::string strExePathS = strPath; size_t found = strExePathS.find_last_of("/\\"); strExePathS = strExePathS.substr(0,found); SetCurrentDirectory(strExePathS.c_str()); title += " - "; if (PathCompactPathEx(strPath, filename.c_str(), 64, NULL)) { title += strPath; } else { title += filename; } } #else title += " - "; title += filename; #endif // Create and open a new SFML window. rw = new sf::RenderWindow(); rw->create(sf::VideoMode(800, 600), title, sf::Style::Default, sf::ContextSettings(16, 0, 4)); // Setup VA for drawing the waveforms/transforms. vertexArray.resize(WINDOW_BUFFER_SIZE); vertexArray.setPrimitiveType(sf::LinesStrip); // Corner beat/bass orbs. orbBeat = sf::CircleShape(1.f, 60u); orbBass = sf::CircleShape(1.f, 60u); orbBeat.setPosition(0.f, (float)rw->getSize().y); orbBass.setPosition((float)rw->getSize().x, (float)rw->getSize().y); orbBeat.setOrigin(1.f, 1.f); orbBass.setOrigin(1.f, 1.f); orbBeat.setFillColor(sf::Color(255, 180, 0, 200)); orbBass.setFillColor(sf::Color(0, 180, 255, 200)); // Frequency subbands. for (unsigned i = 0; i < NUM_FREQBARS; ++i) { freqBars[i].value = 0.; freqBars[i].linePos = 0.; freqBars[i].lineVel = 0.; } // Set up font so we can render text. fontDebug = new sf::Font(); if (!fontDebug->loadFromFile("font.ttf")) logWarning("initialize", "unable to load font file (filename=\"%s\"), file may be corrupted, unreadable, an invalid format, or not exist\n", "font.ttf"); // Set up debug text. txtDebug.setFont(*fontDebug); txtDebug.setPosition(10.f, 10.f); txtDebug.setCharacterSize(14); // Let SFML decode the audio file if it isn't an mp3. // SFML will use streaming to load the audio. audio = new AudioFileStream(); if (!audio->openFromFile(filename)) return false; // Update every 1024 samples. continueInterval = sf::seconds(1024.f / audio->getSampleRate()); nextContinue = continueInterval; // Initialize everything else. showSubBands = true; showOrbs = true; drawMode = DRAW_FFT; debugMode = false; mouseHoverProgressBar = false; // Some controls information. printf("libfada - Example Visualizer\n"); printf("Playing '%s'\n", filename.c_str()); printf("Left-click on the progress bar at the bottom of the screen to seek.\n"); printf("\n"); printf("[0]\tNone\n"); printf("[1]\tStereo FFT (if applicable)\n"); printf("[2]\tStereo waveform (if applicable)\n"); printf("[3]\tMixed FFT\n"); printf("[4]\tMixed waveform\n"); printf("\n"); printf("[I]\tToggle subband bars\n"); printf("[O]\tToggle orbs\n"); printf("[~]\tToggle debug mode\n"); printf("\n"); // Start the audio. audio->play(); return true; } ////////////////////////////////////////////////// void finish() { sf::Lock lock(mutex); if (audio) { audio->stop(); delete audio; } if (fontDebug) delete fontDebug; if (rw) { if (rw->isOpen()) rw->close(); delete rw; } } ////////////////////////////////////////////////// void processEvents() { sf::Lock lock(mutex); sf::Event ev; while (rw->pollEvent(ev)) switch(ev.type) { case sf::Event::Closed: onWindowClose(); break; case sf::Event::Resized: onWindowResize(ev.size.width, ev.size.height); break; case sf::Event::MouseButtonPressed: onMouseDown(ev.mouseButton.x, ev.mouseButton.y, ev.mouseButton.button); break; case sf::Event::MouseButtonReleased: onMouseUp(ev.mouseButton.x, ev.mouseButton.y, ev.mouseButton.button); break; case sf::Event::MouseMoved: { static int px = ev.mouseMove.x, py = ev.mouseMove.y; onMouseMove(ev.mouseMove.x, ev.mouseMove.y, ev.mouseMove.x - px, ev.mouseMove.y - py); px = ev.mouseMove.x; py = ev.mouseMove.y; } break; case sf::Event::MouseWheelMoved: onMouseWheel(ev.mouseWheel.x, ev.mouseWheel.y, ev.mouseWheel.delta); break; case sf::Event::KeyPressed: onKeyDown(ev.key.code); break; case sf::Event::KeyReleased: onKeyUp(ev.key.code); break; } } ////////////////////////////////////////////////// void tick(float ms) { sf::Lock lock(mutex); static bool updateReady = true; const float SCRW = static_cast<float>(rw->getSize().x); const float SCRH = static_cast<float>(rw->getSize().y); if (!audio->isReady()) return; if (updateReady) { // Update FADA beat, bass and FFT. audio->update(); // Update sub-band values. const fada_Res FACTOR = 1.0; audio->useFFTMixedBuffer(); freqBars[11].value = calcFreqBar(0, 3) / FACTOR; // 0 - 43 Hz freqBars[10].value = calcFreqBar(4, 7) / FACTOR; // 43 - 86 Hz freqBars[9].value = calcFreqBar(8, 15) / FACTOR; // 86 - 167 Hz freqBars[8].value = calcFreqBar(16, 31) / FACTOR; // 167 - 344 Hz freqBars[7].value = calcFreqBar(32, 63) / FACTOR; // 344 - 689 Hz freqBars[6].value = calcFreqBar(64, 127) / FACTOR; // 689 - 1378 Hz freqBars[5].value = calcFreqBar(128, 255) / FACTOR; // 1378 - 2756 Hz freqBars[4].value = calcFreqBar(256, 511) / FACTOR; // 2756 - 5512 Hz freqBars[3].value = calcFreqBar(512, 767) / FACTOR; // 5512 - 8268 Hz freqBars[2].value = calcFreqBar(768, 1023) / FACTOR; // 8268 - 11025 Hz freqBars[1].value = calcFreqBar(1024, 1535) / FACTOR; // 11025 - 16537 Hz freqBars[0].value = calcFreqBar(1536, 2047) / FACTOR; // 16537 - 22050 Hz // Update orbs based on beat and bass values. orbBeat.setScale(static_cast<float>(audio->getBeat() * 7000.), static_cast<float>(audio->getBeat() * 7000.)); orbBass.setScale(static_cast<float>(audio->getBass() * 700.), static_cast<float>(audio->getBass() * 700.)); updateReady = false; } // Update sub-bands. for (unsigned i = 0; i < NUM_FREQBARS; ++i) { FreqBar& bar = freqBars[i]; bar.lineVel += 0.0005; bar.linePos -= bar.lineVel; if (bar.linePos < bar.value) { bar.linePos = bar.value; bar.lineVel = 0.; } if (bar.linePos < 0.) { bar.linePos = 0.; bar.lineVel = 0.; } } // Move FADA to the next window when audio has finished playing the current set of 1024 samples. while (audio->getPlayingOffset() >= nextContinue) { nextContinue += continueInterval; audio->advance(1024); updateReady = true; } // Stop program when audio is finished. if (audio->getStatus() == sf::Music::Stopped) isRunning = false; } ////////////////////////////////////////////////// void render() { sf::Lock lock(mutex); if (!audio->isReady()) return; const float SCRW = static_cast<float>(rw->getSize().x); const float SCRH = static_cast<float>(rw->getSize().y); const float SCRW_H = SCRW / 2.f; const float SCRH_H = SCRH / 2.f; const unsigned MAX_CHANNEL_COLOURS = 8; const sf::Color CHANNEL_COLOURS[MAX_CHANNEL_COLOURS] = { sf::Color(200, 80, 80), sf::Color( 80, 80, 200), sf::Color( 80, 200, 80), sf::Color(200, 80, 200), sf::Color(200, 200, 80), sf::Color( 80, 200, 200), sf::Color( 80, 80, 80), sf::Color(200, 200, 200) }; rw->clear(); // Draw subband bars. if (showSubBands) { for (unsigned i = 0; i < NUM_FREQBARS; ++i) { sf::RectangleShape r; FreqBar& bar = freqBars[i]; double p = bar.linePos * 3.; p = (p < 0.) ? 0. : (p > 2.) ? 2. : p; unsigned char red, green; red = (p >= 1.) ? 255 : static_cast<unsigned char>(floor( p * 255.)); green = (p <= 1.) ? 255 : static_cast<unsigned char>(floor((1.-p) * 255.)); float x, width; width = (SCRW_H / NUM_FREQBARS) - 10.f; x = (width + 10.f) * i + 10.f + (SCRW_H / 2.f); // Draw bar. r.setSize(sf::Vector2f(width, -static_cast<float>(bar.value * SCRH / 2.) )); r.setPosition(x, SCRH + 16.f); r.setFillColor(sf::Color(red, green, 40, 160)); rw->draw(r); p = bar.linePos * SCRH / 2.; p = (p < 12.) ? 12. : p; // Draw falling bar. r.setSize(sf::Vector2f( (SCRW_H / NUM_FREQBARS) - 10.f, 12.f) ); r.setPosition(x, -static_cast<float>(p) + SCRH); r.setFillColor(sf::Color(255, 255, 255, 160)); rw->draw(r); } } // Draw beat and bass orbs. if (showOrbs) { rw->draw(orbBeat); rw->draw(orbBass); } // Draw progress bar. { float progress = audio->getPlayingOffset().asSeconds() / audio->getDuration().asSeconds(); sf::RectangleShape r; r.setFillColor(sf::Color(80, 80, 255)); r.setPosition(0.f, SCRH - 6.f); r.setSize(sf::Vector2f(progress * SCRW, 6.f)); rw->draw(r, sf::RenderStates(sf::BlendAdd)); // Mouse-over highlight. if (mouseHoverProgressBar) { sf::VertexArray va; va.setPrimitiveType(sf::Quads); va.resize(4); va[0].position.x = 0.f; va[0].position.y = SCRH; va[1].position.x = SCRW; va[1].position.y = SCRH; va[2].position.x = va[1].position.x; va[2].position.y = va[1].position.y - 16.f; va[3].position.x = va[0].position.x; va[3].position.y = va[0].position.y - 16.f; va[0].color = sf::Color(200, 200, 200); va[1].color = va[0].color; va[2].color = sf::Color::Transparent; va[3].color = va[2].color; rw->draw(va, sf::RenderStates(sf::BlendAdd)); } } // Draw FFT/Waveform. if (drawMode == DRAW_FFT) { // Draw FFTs for each channel. for (size_t c = 0, chans = audio->getChannelCount(); c < chans && c < MAX_CHANNEL_COLOURS; ++c) { audio->useFFTBuffer(c); audio->getFFTValues(resultBuffer, 0, WINDOW_BUFFER_SIZE); for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz && i < FFT_BUFFER_SIZE; ++i) { sf::Vertex& v = vertexArray[i]; v.color = CHANNEL_COLOURS[c]; v.position.x = i / static_cast<float>(sz) * SCRW; v.position.y = SCRH_H - static_cast<float>(resultBuffer[i] * SCRH * 10); } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); // Mirror Y coodinates. for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz && i < FFT_BUFFER_SIZE; ++i) { sf::Vertex& v = vertexArray[i]; v.position.y = SCRH - v.position.y; } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); } } else if (drawMode == DRAW_FFT_MIXED) { // Draw the mixed-channel FFT. audio->useFFTMixedBuffer(); audio->getFFTValues(resultBuffer, 0, WINDOW_BUFFER_SIZE); const sf::Color mixedColour = sf::Color(100, 220, 220); for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz && i < FFT_BUFFER_SIZE; ++i) { sf::Vertex& v = vertexArray[i]; v.color = mixedColour; v.position.x = i / static_cast<float>(sz) * SCRW; v.position.y = SCRH_H - static_cast<float>(resultBuffer[i] * SCRH * 10); } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); // Mirror Y coodinates. for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz; ++i) { sf::Vertex& v = vertexArray[i]; v.position.y = SCRH - v.position.y; } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); } else if (drawMode == DRAW_WAVEFORM) { // Draw waveforms for each channel. for (size_t c = 0, chans = audio->getChannelCount(); c < chans && c < MAX_CHANNEL_COLOURS; ++c) { CHECK_FADA(fada_getsamples(audio->getManager(), c, resultBuffer)); for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz; ++i) { sf::Vertex& v = vertexArray[i]; v.color = CHANNEL_COLOURS[c]; v.position.x = i / static_cast<float>(sz) * SCRW; v.position.y = SCRH_H + static_cast<float>(resultBuffer[i] / audio->getNormal()) * (SCRH / 3.f); } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); } } else if (drawMode == DRAW_WAVEFORM_MIXED) { CHECK_FADA(fada_getframes(audio->getManager(), resultBuffer)); const sf::Color mixedColour = sf::Color(100, 220, 220); // Mixed channels. for (size_t i = 0, sz = vertexArray.getVertexCount(); i < sz; ++i) { sf::Vertex& v = vertexArray[i]; v.color = mixedColour; v.position.x = i / static_cast<float>(sz) * SCRW; v.position.y = SCRH_H + static_cast<float>(resultBuffer[i] / audio->getNormal()) * (SCRH / 3.f); } rw->draw(vertexArray, sf::RenderStates(sf::BlendAdd)); } // Draw debug to display FPS and tick MS. if (debugMode) { char buf[32]; sprintf(buf, "FPS: %.0f\nMS: %.2f", debugFPS, debugMS); txtDebug.setString(buf); txtDebug.setColor(sf::Color::Black); txtDebug.move(1.5f, 1.5f); rw->draw(txtDebug); txtDebug.move(-1.5f, -1.5f); txtDebug.setColor(sf::Color::White); rw->draw(txtDebug); } rw->display(); } ////////////////////////////////////////////////// fada_Res calcFreqBar(fada_Pos start, fada_Pos end) { const fada_Manager* fada = audio->getManager(); fada_Pos fft_sz = fada_getfftsize(fada); if (start >= fft_sz) return 0.; if (end >= fft_sz) end = fft_sz-1; fada_Res cur; fada_Res res = 0.; for (unsigned i = start; i <= end; ++i) { CHECK_FADA(fada_getfftvalue(fada, i, &cur)); res += cur; } return res; } ////////////////////////////////////////////////// void onMouseDown(int x, int y, unsigned b) { #ifdef _WINDOWS_ // Weird SFML 2.1 bug on Windows - force window to focus when clicked on. ::SetFocus(rw->getSystemHandle()); #endif } ////////////////////////////////////////////////// void onMouseUp(int x, int y, unsigned b) { if (b != sf::Mouse::Left) return; // Audio seeking. if (mouseHoverProgressBar) { sf::Time offset = audio->getDuration() * (static_cast<float>(x) / rw->getSize().x); audio->setPlayingOffset(offset); nextContinue = offset; } } ////////////////////////////////////////////////// void onMouseWheel(int x, int y, int d) { } ////////////////////////////////////////////////// void onMouseMove(int x, int y, int dx, int dy) { mouseHoverProgressBar = ( static_cast<unsigned int>(y) > rw->getSize().y - 32 ); } ////////////////////////////////////////////////// void onKeyDown(int key) { switch (key) { // Debug mode. case sf::Keyboard::Tilde: debugMode = !debugMode; break; // Show subband bars. case sf::Keyboard::I: showSubBands = !showSubBands; break; // Show orbs. case sf::Keyboard::O: showOrbs = !showOrbs; break; // Draw modes. case sf::Keyboard::Num0: case sf::Keyboard::Numpad0: drawMode = DRAW_NONE; break; case sf::Keyboard::Num1: case sf::Keyboard::Numpad1: drawMode = DRAW_FFT; break; case sf::Keyboard::Num2: case sf::Keyboard::Numpad2: drawMode = DRAW_WAVEFORM; break; case sf::Keyboard::Num3: case sf::Keyboard::Numpad3: drawMode = DRAW_FFT_MIXED; break; case sf::Keyboard::Num4: case sf::Keyboard::Numpad4: drawMode = DRAW_WAVEFORM_MIXED; break; } } ////////////////////////////////////////////////// void onKeyUp(int key) { } ////////////////////////////////////////////////// void onWindowResize(unsigned w, unsigned h) { // Modify view to fill the new screen size. sf::View view = rw->getView(); view.setSize(static_cast<float>(w), static_cast<float>(h)); view.setCenter(w/2.f, h/2.f); rw->setView(view); // Reset positions of orbs. orbBeat.setPosition(0.f, static_cast<float>(rw->getSize().y)); orbBass.setPosition(static_cast<float>(rw->getSize().x), static_cast<float>(rw->getSize().y)); } ////////////////////////////////////////////////// void onWindowClose() { isRunning = false; } ////////////////////////////////////////////////// void logMessage(const char* where, const char* fmt, ...) { va_list args; va_start(args, fmt); printf("[INFO] (in '%s'): ", where); vprintf(fmt, args); va_end(args); } ////////////////////////////////////////////////// void logWarning(const char* where, const char* fmt, ...) { va_list args; va_start(args, fmt); printf("[WARNING] (in '%s'): ", where); vprintf(fmt, args); va_end(args); } ////////////////////////////////////////////////// void logError(const char* where, const char* fmt, ...) { va_list args; va_start(args, fmt); printf("[ERROR] (in '%s'): ", where); vprintf(fmt, args); va_end(args); } ////////////////////////////////////////////////// fada_Error checkFADA(unsigned int line, fada_Error err) { if (err != FADA_ERROR_SUCCESS) { char buf[16]; char* msg; switch (err) { default: msg = "unknown error"; break; case FADA_ERROR_INVALID_MANAGER: msg = "passed an invalid manager"; break; case FADA_ERROR_INVALID_PARAMETER: msg = "passed an invalid parameter"; break; case FADA_ERROR_INVALID_TYPE: msg = "manager does not have a valid sample type bound to it"; break; case FADA_ERROR_INVALID_SIZE: msg = "passed an invalid size"; break; case FADA_ERROR_INVALID_SAMPLE_RATE: msg = "passed an invalid sample rate"; break; case FADA_ERROR_INVALID_CHANNEL: msg = "passed an invalid channel index"; break; case FADA_ERROR_INVALID_FFT_BUFFER: msg = "passed an invalid FFT buffer"; break; case FADA_ERROR_MANAGER_NOT_READY: msg = "manager is not ready yet"; break; case FADA_ERROR_NO_DATA: msg = "no data was bound to the manager"; break; case FADA_ERROR_NOT_MULTIPLE_OF_CHANNELS: msg = "value was not a multiple of the channel count"; break; case FADA_ERROR_NOT_ENOUGH_MEMORY: msg = "not enough memory"; break; case FADA_ERROR_INDEX_OUT_OF_BOUNDS: msg = "index was out of bounds"; break; case FADA_ERROR_POSITION_OUT_OF_BOUNDS: msg = "position was out of bounds"; break; case FADA_ERROR_FREQUENCY_OUT_OF_BOUNDS: msg = "frequency was out of the valid frequency range"; break; case FADA_ERROR_WINDOW_NOT_CREATED: msg = "manager does not have a window buffer created"; break; } sprintf(buf, "Line %d", line); logWarning(buf, "libfada check failed (error=%d): %s\n", err, msg); } return err; }
24.139535
178
0.603261
ief015
ace411b3a3f20ac6879fbaa863a943dedd909894
1,362
hh
C++
include/Activia/ActGuiRun.hh
UniversityofWarwick/ACTIVIA
bbd0dfa71337602f94d911fa5101a440e8c16606
[ "BSL-1.0" ]
1
2020-11-04T08:32:23.000Z
2020-11-04T08:32:23.000Z
include/Activia/ActGuiRun.hh
UniversityofWarwick/ACTIVIA
bbd0dfa71337602f94d911fa5101a440e8c16606
[ "BSL-1.0" ]
null
null
null
include/Activia/ActGuiRun.hh
UniversityofWarwick/ACTIVIA
bbd0dfa71337602f94d911fa5101a440e8c16606
[ "BSL-1.0" ]
1
2020-11-04T08:32:30.000Z
2020-11-04T08:32:30.000Z
#ifdef ACT_USE_QT #ifndef ACT_GUI_RUN_HH #define ACT_GUI_RUN_HH #include "Activia/ActAbsRun.hh" #include "Activia/ActGuiWindow.hh" #include "QtGui/qdialog.h" #include "QtGui/qmenubar.h" #include "QtGui/qprogressbar.h" /// \brief Run all of the isotope production code using a GUI /// /// All relevent input and output classes as well as the /// cross-section and isotope yield calculations will be called /// here using the abstract ActAbsRun interface. class ActGuiRun : public QDialog, public ActAbsRun { Q_OBJECT public: /// Constructor ActGuiRun(); /// Destructor virtual ~ActGuiRun(); /// Define how the input to the calculations are obtained. virtual void defineInput(); /// Make the GUI and run the calculations void makeGui(); public slots: /// Run the calculations void runCode(); /// Stop the calculations void stopCode(); /// Create pop-up window with brief description about the software void about(); /// Create pop-up window showing the usage license for the code void license(); /// Clear all GUI inputs void clearInput(); /// Save the GUI inputs void saveInput(); /// Load the GUI inputs void loadInput(); protected: private: QProgressBar* _progressBar; ActGuiWindow* _guiWindow; /// Create the top menu bar for the GUI QMenuBar* createMenu(); }; #endif #endif
19.457143
68
0.707048
UniversityofWarwick
ace45f838efefc721e7e28f82d34c4a06ce2b73d
9,652
cc
C++
processors/IA32/bochs/cpu/bit32.cc
pavel-krivanek/opensmalltalk-vm
694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16
[ "MIT" ]
445
2016-06-30T08:19:11.000Z
2022-03-28T06:09:49.000Z
processors/IA32/bochs/cpu/bit32.cc
pavel-krivanek/opensmalltalk-vm
694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16
[ "MIT" ]
439
2016-06-29T20:14:36.000Z
2022-03-17T19:59:58.000Z
processors/IA32/bochs/cpu/bit32.cc
pavel-krivanek/opensmalltalk-vm
694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16
[ "MIT" ]
137
2016-07-02T17:32:07.000Z
2022-03-20T11:17:25.000Z
///////////////////////////////////////////////////////////////////////// // $Id: bit32.cc,v 1.14 2008/08/11 18:53:23 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. // // MandrakeSoft S.A. // 43, rue d'Aboukir // 75002 Paris - France // http://www.linux-mandrake.com/ // http://www.mandrakesoft.com/ // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ///////////////////////////////////////////////////////////////////////// #define NEED_CPU_REG_SHORTCUTS 1 #include "bochs.h" #include "cpu.h" #define LOG_THIS BX_CPU_THIS_PTR #if BX_CPU_LEVEL >= 3 void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSF_GdEdR(bxInstruction_c *i) { Bit32u op2_32 = BX_READ_32BIT_REG(i->rm()); if (op2_32 == 0) { assert_ZF(); /* op1_32 undefined */ } else { Bit32u op1_32 = 0; while ((op2_32 & 0x01) == 0) { op1_32++; op2_32 >>= 1; } SET_FLAGS_OSZAPC_LOGIC_32(op1_32); clear_ZF(); /* now write result back to destination */ BX_WRITE_32BIT_REGZ(i->nnn(), op1_32); } } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSR_GdEdR(bxInstruction_c *i) { Bit32u op2_32 = BX_READ_32BIT_REG(i->rm()); if (op2_32 == 0) { assert_ZF(); /* op1_32 undefined */ } else { Bit32u op1_32 = 31; while ((op2_32 & 0x80000000) == 0) { op1_32--; op2_32 <<= 1; } SET_FLAGS_OSZAPC_LOGIC_32(op1_32); clear_ZF(); /* now write result back to destination */ BX_WRITE_32BIT_REGZ(i->nnn(), op1_32); } } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdGdM(bxInstruction_c *i) { bx_address op1_addr; Bit32u op1_32, op2_32, index; Bit32s displacement32; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); op2_32 = BX_READ_32BIT_REG(i->nnn()); index = op2_32 & 0x1f; displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32; op1_addr = eaddr + 4 * displacement32; if (! i->as32L()) op1_addr = (Bit16u) op1_addr; #if BX_SUPPORT_X86_64 else if (! i->as64L()) op1_addr = (Bit32u) op1_addr; #endif /* pointer, segment address pair */ op1_32 = read_virtual_dword(i->seg(), op1_addr); set_CF((op1_32 >> index) & 0x01); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdGdR(bxInstruction_c *i) { Bit32u op1_32, op2_32; op1_32 = BX_READ_32BIT_REG(i->rm()); op2_32 = BX_READ_32BIT_REG(i->nnn()); op2_32 &= 0x1f; set_CF((op1_32 >> op2_32) & 0x01); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdGdM(bxInstruction_c *i) { bx_address op1_addr; Bit32u op1_32, op2_32, index; Bit32s displacement32; bx_bool bit_i; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); op2_32 = BX_READ_32BIT_REG(i->nnn()); index = op2_32 & 0x1f; displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32; op1_addr = eaddr + 4 * displacement32; if (! i->as32L()) op1_addr = (Bit16u) op1_addr; #if BX_SUPPORT_X86_64 else if (! i->as64L()) op1_addr = (Bit32u) op1_addr; #endif /* pointer, segment address pair */ op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr); bit_i = (op1_32 >> index) & 0x01; op1_32 |= (((Bit32u) 1) << index); write_RMW_virtual_dword(op1_32); set_CF(bit_i); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdGdR(bxInstruction_c *i) { Bit32u op1_32, op2_32; op1_32 = BX_READ_32BIT_REG(i->rm()); op2_32 = BX_READ_32BIT_REG(i->nnn()); op2_32 &= 0x1f; set_CF((op1_32 >> op2_32) & 0x01); op1_32 |= (((Bit32u) 1) << op2_32); /* now write result back to the destination */ BX_WRITE_32BIT_REGZ(i->rm(), op1_32); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdGdM(bxInstruction_c *i) { bx_address op1_addr; Bit32u op1_32, op2_32, index; Bit32s displacement32; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); op2_32 = BX_READ_32BIT_REG(i->nnn()); index = op2_32 & 0x1f; displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32; op1_addr = eaddr + 4 * displacement32; if (! i->as32L()) op1_addr = (Bit16u) op1_addr; #if BX_SUPPORT_X86_64 else if (! i->as64L()) op1_addr = (Bit32u) op1_addr; #endif /* pointer, segment address pair */ op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr); bx_bool temp_cf = (op1_32 >> index) & 0x01; op1_32 &= ~(((Bit32u) 1) << index); /* now write back to destination */ write_RMW_virtual_dword(op1_32); set_CF(temp_cf); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdGdR(bxInstruction_c *i) { Bit32u op1_32, op2_32; op1_32 = BX_READ_32BIT_REG(i->rm()); op2_32 = BX_READ_32BIT_REG(i->nnn()); op2_32 &= 0x1f; set_CF((op1_32 >> op2_32) & 0x01); op1_32 &= ~(((Bit32u) 1) << op2_32); /* now write result back to the destination */ BX_WRITE_32BIT_REGZ(i->rm(), op1_32); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdGdM(bxInstruction_c *i) { bx_address op1_addr; Bit32u op1_32, op2_32, index_32; Bit32s displacement32; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); op2_32 = BX_READ_32BIT_REG(i->nnn()); index_32 = op2_32 & 0x1f; displacement32 = ((Bit32s) (op2_32 & 0xffffffe0)) / 32; op1_addr = eaddr + 4 * displacement32; if (! i->as32L()) op1_addr = (Bit16u) op1_addr; #if BX_SUPPORT_X86_64 else if (! i->as64L()) op1_addr = (Bit32u) op1_addr; #endif op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr); bx_bool temp_CF = (op1_32 >> index_32) & 0x01; op1_32 ^= (((Bit32u) 1) << index_32); /* toggle bit */ set_CF(temp_CF); write_RMW_virtual_dword(op1_32); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdGdR(bxInstruction_c *i) { Bit32u op1_32, op2_32; op1_32 = BX_READ_32BIT_REG(i->rm()); op2_32 = BX_READ_32BIT_REG(i->nnn()); op2_32 &= 0x1f; bx_bool temp_CF = (op1_32 >> op2_32) & 0x01; op1_32 ^= (((Bit32u) 1) << op2_32); /* toggle bit */ set_CF(temp_CF); BX_WRITE_32BIT_REGZ(i->rm(), op1_32); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdIbM(bxInstruction_c *i) { bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1_32 = read_virtual_dword(i->seg(), eaddr); Bit8u op2_8 = i->Ib() & 0x1f; set_CF((op1_32 >> op2_8) & 0x01); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdIbR(bxInstruction_c *i) { Bit32u op1_32 = BX_READ_32BIT_REG(i->rm()); Bit8u op2_8 = i->Ib() & 0x1f; set_CF((op1_32 >> op2_8) & 0x01); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdIbM(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 |= (((Bit32u) 1) << op2_8); write_RMW_virtual_dword(op1_32); set_CF(temp_CF); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdIbR(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; Bit32u op1_32 = BX_READ_32BIT_REG(i->rm()); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 |= (((Bit32u) 1) << op2_8); BX_WRITE_32BIT_REGZ(i->rm(), op1_32); set_CF(temp_CF); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdIbM(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 ^= (((Bit32u) 1) << op2_8); /* toggle bit */ write_RMW_virtual_dword(op1_32); set_CF(temp_CF); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdIbR(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; Bit32u op1_32 = BX_READ_32BIT_REG(i->rm()); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 ^= (((Bit32u) 1) << op2_8); /* toggle bit */ BX_WRITE_32BIT_REGZ(i->rm(), op1_32); set_CF(temp_CF); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdIbM(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 &= ~(((Bit32u) 1) << op2_8); write_RMW_virtual_dword(op1_32); set_CF(temp_CF); } void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdIbR(bxInstruction_c *i) { Bit8u op2_8 = i->Ib() & 0x1f; Bit32u op1_32 = BX_READ_32BIT_REG(i->rm()); bx_bool temp_CF = (op1_32 >> op2_8) & 0x01; op1_32 &= ~(((Bit32u) 1) << op2_8); BX_WRITE_32BIT_REGZ(i->rm(), op1_32); set_CF(temp_CF); } /* 0F B8 */ void BX_CPP_AttrRegparmN(1) BX_CPU_C::POPCNT_GdEdR(bxInstruction_c *i) { #if BX_SUPPORT_POPCNT || (BX_SUPPORT_SSE > 4) || (BX_SUPPORT_SSE >= 4 && BX_SUPPORT_SSE_EXTENSION > 0) Bit32u op2_32 = BX_READ_32BIT_REG(i->rm()); Bit32u op1_32 = 0; while (op2_32 != 0) { if (op2_32 & 1) op1_32++; op2_32 >>= 1; } Bit32u flags = op1_32 ? 0 : EFlagsZFMask; setEFlagsOSZAPC(flags); /* now write result back to destination */ BX_WRITE_32BIT_REGZ(i->nnn(), op1_32); #else BX_INFO(("POPCNT_GdEd: required POPCNT support, use --enable-popcnt option")); exception(BX_UD_EXCEPTION, 0, 0); #endif } #endif // (BX_CPU_LEVEL >= 3)
26.228261
102
0.657688
pavel-krivanek
ace4a50850d5f4d87cbe2a154f3840bcdccfc00b
17,895
cpp
C++
YGO3_Decoder/YGO3_Decoder.cpp
xan1242/ygo3_decoder
ed2344021c7a9ee92efbd2059ce7da245705ac1a
[ "MIT" ]
null
null
null
YGO3_Decoder/YGO3_Decoder.cpp
xan1242/ygo3_decoder
ed2344021c7a9ee92efbd2059ce7da245705ac1a
[ "MIT" ]
null
null
null
YGO3_Decoder/YGO3_Decoder.cpp
xan1242/ygo3_decoder
ed2344021c7a9ee92efbd2059ce7da245705ac1a
[ "MIT" ]
null
null
null
// Yu-Gi-Oh! Online 3 File Codec // #include "stdafx.h" #include "DecodeKeys.h" #include <stdlib.h> #include <string.h> char DecodeKeys1[0x48] = DECODE_KEYS_1; char DecodeKeys2[0x1000] = DECODE_KEYS_2; char* OutputFileName; char FileExt[16]; unsigned int KeyPointers[2]; struct stat st = { 0 }; void __declspec(naked) sub_10E2640() { _asm { push ebx push ebp push esi mov esi, eax mov edx, [esi + 4] mov eax, [esp + 0x10] push edi mov edi, [esi] mov ecx, [edi + 0x44] xor ecx, [eax] mov eax, ecx shr eax, 0x10 and eax, 0xFF mov eax, [edx + eax * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add eax, [edx + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor eax, [edx + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add eax, [edx + ebx * 4 + 0xC00] mov ebx, [esp + 0x18] xor eax, [edi + 0x40] xor eax, [ebx] mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x3C] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x38] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x34] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] mov esi, edx xor ebx, [edi + 0x30] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x2C] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x28] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x24] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov edx, ecx shr edx, 8 and edx, 0xFF xor ebx, [esi + edx * 4 + 0x800] mov edx, ecx and edx, 0xFF add ebx, [esi + edx * 4 + 0xC00] xor ebx, [edi + 0x20] xor eax, ebx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x1C] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x18] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x14] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x10] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0xC] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 8] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 4] xor ecx, edx mov edx, [edi] xor edx, eax mov eax, [esp + 0x14] pop edi pop esi mov[eax], edx mov edx, [esp + 0x10] pop ebp mov[edx], ecx pop ebx retn } } void __declspec(naked) sub_10E2210() { _asm { push ebx push ebp push esi mov esi, eax mov edx, [esi + 4] mov eax, [esp + 0x10] mov ecx, [eax] push edi mov edi, [esi] xor ecx, [edi] mov eax, ecx shr eax, 0x10 and eax, 0xFF mov eax, [edx + eax * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add eax, [edx + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor eax, [edx + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add eax, [edx + ebx * 4 + 0xC00] mov ebx, [esp + 0x18] xor eax, [edi + 4] xor eax, [ebx] mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 8] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0xC] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x10] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] mov esi, edx xor ebx, [edi + 0x14] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x18] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, ecx shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, ecx and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x1C] xor eax, ebx mov ebx, eax shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, eax shr ebp, 0x18 add ebx, [edx + ebp * 4] mov ebp, eax shr ebp, 8 and ebp, 0xFF xor ebx, [edx + ebp * 4 + 0x800] mov ebp, eax and ebp, 0xFF add ebx, [edx + ebp * 4 + 0xC00] xor ebx, [edi + 0x20] xor ecx, ebx mov ebx, ecx shr ebx, 0x10 and ebx, 0xFF mov ebx, [edx + ebx * 4 + 0x400] mov ebp, ecx shr ebp, 0x18 add ebx, [edx + ebp * 4] mov edx, ecx shr edx, 8 and edx, 0xFF xor ebx, [esi + edx * 4 + 0x800] mov edx, ecx and edx, 0xFF add ebx, [esi + edx * 4 + 0xC00] xor ebx, [edi + 0x24] xor eax, ebx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x28] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x2C] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x30] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x34] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x38] xor ecx, edx mov edx, ecx shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, ecx shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, ecx shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, ecx and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x3C] xor eax, edx mov edx, eax shr edx, 0x10 and edx, 0xFF mov edx, [esi + edx * 4 + 0x400] mov ebx, eax shr ebx, 0x18 add edx, [esi + ebx * 4] mov ebx, eax shr ebx, 8 and ebx, 0xFF xor edx, [esi + ebx * 4 + 0x800] mov ebx, eax xor eax, [edi + 0x44] and ebx, 0xFF add edx, [esi + ebx * 4 + 0xC00] xor edx, [edi + 0x40] pop edi xor ecx, edx mov edx, [esp + 0x14] pop esi mov[edx], ecx mov ecx, [esp + 0xC] pop ebp mov[ecx], eax pop ebx retn 8 } } int YGO3Encoder(int Length, int XORKeys, int InputBuffer) { int v4; int v6; int v7; unsigned int v8; int result; int v10; int v15; unsigned int v16; unsigned int something; v4 = Length; v6 = InputBuffer; v7 = Length; if (Length & 7) { v7 = Length - (Length & 7) + 8; v15 = Length - (Length & 7) + 8; } else { v15 = Length; } v8 = 0; v16 = 0; if (v7) { while (1) { v10 = v4 - 7; if (v8 >= v10) { if (v7 - v4 > 0) memset((void *)(v6 + v4), 0, v7 - v4); something = v6 + 4; _asm { push something push v6 mov eax, XORKeys call sub_10E2210 } v6 += 8; } else { something = v6 + 4; _asm { push something push v6 mov eax, XORKeys call sub_10E2210 } v6 += 8; } v8 += 8; v16 = v8; if (v8 >= v15) break; v7 = v15; } result = v15; } else { result = 0; } return result; } int YGO3Decoder(int Length, int XORKeys, int InputBuffer) { int v4; unsigned int v6; unsigned int something; v4 = InputBuffer; if (Length) { v6 = ((unsigned int)(Length - 1) >> 3) + 1; do { something = v4 + 4; _asm { push something push v4 mov eax, XORKeys call sub_10E2640 add esp, 8 } v4 += 8; --v6; } while (v6); } return 0; } int EncodeYGO3File(char* InFilename, char* OutFilename) { FILE* fin = fopen(InFilename, "rb"); unsigned int FileLength = 0; void* InBuffer = NULL; if (fin == NULL) { printf("ERROR: Can't open file for reading: %s\n", InFilename); perror("ERROR"); return -1; } stat(InFilename, &st); InBuffer = malloc(st.st_size); fread(InBuffer, st.st_size, 1, fin); KeyPointers[0] = (int)DecodeKeys1; KeyPointers[1] = (int)DecodeKeys2; YGO3Encoder(st.st_size, (int)KeyPointers, (int)InBuffer); FILE* fout = fopen(OutFilename, "wb"); if (fout == NULL) { printf("ERROR: Can't open file for writing: %s\n", OutFilename); perror("ERROR"); return -1; } FileLength = _byteswap_ulong(st.st_size ^ 0x77777777); fwrite(&FileLength, sizeof(int), 1, fout); fwrite(InBuffer, st.st_size, 1, fout); fclose(fout); fclose(fin); return 0; } int DecodeYGO3File(char* InFilename, char* OutFilename) { FILE* fin = fopen(InFilename, "rb"); unsigned int FileLength = 0; void* InBuffer = NULL; if (fin == NULL) { printf("ERROR: Can't open file for reading: %s\n", InFilename); perror("ERROR"); return -1; } fread(&FileLength, sizeof(int), 1, fin); FileLength = _byteswap_ulong(FileLength); FileLength ^= 0x77777777; InBuffer = malloc(FileLength); fread(InBuffer, FileLength, 1, fin); KeyPointers[0] = (int)DecodeKeys1; KeyPointers[1] = (int)DecodeKeys2; YGO3Decoder(FileLength, (int)KeyPointers, (int)InBuffer); FILE* fout = fopen(OutFilename, "wb"); if (fout == NULL) { printf("ERROR: Can't open file for writing: %s\n", OutFilename); perror("ERROR"); return -1; } fwrite(InBuffer, FileLength, 1, fout); fclose(fout); fclose(fin); return 0; } int main(int argc, char *argv[]) { printf("Yu-Gi-Oh! Online 3 File Codec\n"); if (argc < 2) { printf("USAGE (decode): %s InFileName [OutFileName]\n", argv[0]); printf("USAGE (encode): %s -e InFileName [OutFileName]\n", argv[0]); return -1; } if (argv[1][0] == '-' && argv[1][1] == 'e') // encoding mode { if (argc == 3) { char* PatchPoint; OutputFileName = (char*)calloc(strlen(argv[2]), sizeof(char) + 8); strcpy(OutputFileName, argv[2]); PatchPoint = strrchr(OutputFileName, '.'); strcpy(FileExt, PatchPoint); sprintf(PatchPoint, "_encoded%s", FileExt); } else OutputFileName = argv[3]; return EncodeYGO3File(argv[2], OutputFileName); } if (argc == 2) { char* PatchPoint; OutputFileName = (char*)calloc(strlen(argv[1]), sizeof(char) + 8); strcpy(OutputFileName, argv[1]); PatchPoint = strrchr(OutputFileName, '.'); strcpy(FileExt, PatchPoint); sprintf(PatchPoint, "_decoded%s", FileExt); } else OutputFileName = argv[2]; return DecodeYGO3File(argv[1], OutputFileName); }
21.984029
71
0.501481
xan1242
ace4ff0b3f45dcf59d65921a5707091c2f87a03b
14,919
cpp
C++
Orbit/src/Render/VulkanBase.cpp
JusticesHand/orbit-engine
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
[ "MIT" ]
null
null
null
Orbit/src/Render/VulkanBase.cpp
JusticesHand/orbit-engine
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
[ "MIT" ]
8
2017-09-05T04:12:03.000Z
2017-10-26T03:17:07.000Z
Orbit/src/Render/VulkanBase.cpp
JusticesHand/orbit-engine
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
[ "MIT" ]
null
null
null
/*! @file Render/VulkanBase.cpp */ #include "Render/VulkanBase.h" #include "Input/Window.h" #include <iostream> #if defined(USE_WIN32) #error Win32Window not implemented yet! #elif defined(USE_XWINDOW) #error XWindow is not implemented yet! #elif defined(USE_WAYLAND) #error WaylandWindow is not implemented yet! #else #include <GLFW/glfw3.h> #endif namespace { constexpr bool UseValidation = true; constexpr std::array<const char*, 1> RequiredDeviceExtensions{ VK_KHR_SWAPCHAIN_EXTENSION_NAME }; constexpr std::array<const char*, 1> ValidationLayers{ "VK_LAYER_LUNARG_standard_validation" }; /*! @brief Debug callback function to be run by Vulkan in case of errors. @param flags The flags of the debug error. @param objType The type of the object that triggered the error. @param obj The handle of the object that triggered the error. @param location The location of the object that triggered the error. @param code The error code. @param layerPrefix The prefix of the layer that triggered the error. @param msg The actual message of the error. @param userData User data for the error. @return Whether the error should abort the call or not. For the same behaviour as without debugging layers enabled, it should return VK_FALSE (which it does). */ VKAPI_ATTR VkBool32 VKAPI_CALL debugCallbackFunc( VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char* layerPrefix, const char* msg, void* userData) { std::cerr << "validation layer (" << layerPrefix << "): " << msg << std::endl; return VK_FALSE; } } using namespace Orbit; bool VulkanBase::QueueFamilyIndices::completed() const { return transferQueueFamily != std::numeric_limits<uint32_t>::max() && graphicsQueueFamily != std::numeric_limits<uint32_t>::max() && presentQueueFamily != std::numeric_limits<uint32_t>::max(); } std::set<uint32_t> VulkanBase::QueueFamilyIndices::uniqueQueues() const { return std::set<uint32_t>{ transferQueueFamily, graphicsQueueFamily, presentQueueFamily }; } VulkanBase::VulkanBase(std::nullptr_t) { } VulkanBase::VulkanBase(const Window* window) { std::vector<const char*> extensions; std::vector<const char*> layers; if (UseValidation)// if constexpr { extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); layers.insert(layers.end(), ValidationLayers.begin(), ValidationLayers.end()); } #if defined(USE_WIN32) #error Win32Window not implemented yet #elif defined(USE_XWINDOW) #error XWindow not implemented yet #elif defined(USE_WAYLAND) #error WaylandWindow not implemented yet #else uint32_t glfwExtensionCount = 0; const char** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount); for (uint32_t i = 0; i < glfwExtensionCount; i++) extensions.push_back(glfwExtensions[i]); #endif _instance = createInstance(extensions, layers); _debugCallback = createDebugReportCallback(_instance); _surface = createSurface(window->handle(), _instance); _physicalDevice = pickPhysicalDevice(_instance, _surface); _indices = retrieveQueueFamilyIndices(_physicalDevice, _surface); _device = createDevice(_physicalDevice, _indices); _transferCommandPool = createCommandPool(_device, _indices.transferQueueFamily); _graphicsCommandPool = createCommandPool(_device, _indices.graphicsQueueFamily); } VulkanBase::VulkanBase(VulkanBase&& rhs) : _instance(rhs._instance), _debugCallback(rhs._debugCallback), _surface(rhs._surface), _physicalDevice(rhs._physicalDevice), _device(rhs._device), _indices(rhs._indices), _transferCommandPool(rhs._transferCommandPool), _graphicsCommandPool(rhs._graphicsCommandPool) { rhs._instance = nullptr; rhs._debugCallback = nullptr; rhs._surface = nullptr; rhs._physicalDevice = nullptr; rhs._device = nullptr; rhs._transferCommandPool = nullptr; rhs._graphicsCommandPool = nullptr; } VulkanBase& VulkanBase::operator=(VulkanBase&& rhs) { _instance = rhs._instance; _debugCallback = rhs._debugCallback; _surface = rhs._surface; _physicalDevice = rhs._physicalDevice; _device = rhs._device; _indices = rhs._indices; _transferCommandPool = rhs._transferCommandPool; _graphicsCommandPool = rhs._graphicsCommandPool; rhs._instance = nullptr; rhs._debugCallback = nullptr; rhs._surface = nullptr; rhs._physicalDevice = nullptr; rhs._device = nullptr; rhs._transferCommandPool = nullptr; rhs._graphicsCommandPool = nullptr; return *this; } VulkanBase::~VulkanBase() { if (_graphicsCommandPool) _device.destroyCommandPool(_graphicsCommandPool); if (_transferCommandPool) _device.destroyCommandPool(_transferCommandPool); if (_device) _device.destroy(); if (_surface) _instance.destroySurfaceKHR(_surface); if (_debugCallback) destroyDebugCallback(_instance, _debugCallback); if (_instance) _instance.destroy(); } vk::Instance VulkanBase::instance() const { return _instance; } vk::SurfaceKHR VulkanBase::surface() const { return _surface; } vk::PhysicalDevice VulkanBase::physicalDevice() const { return _physicalDevice; } vk::Device VulkanBase::device() const { return _device; } vk::Queue VulkanBase::transferQueue() const { return _device.getQueue(_indices.transferQueueFamily, 0); } vk::Queue VulkanBase::graphicsQueue() const { return _device.getQueue(_indices.graphicsQueueFamily, 0); } vk::Queue VulkanBase::presentQueue() const { return _device.getQueue(_indices.presentQueueFamily, 0); } vk::CommandPool VulkanBase::transferCommandPool() const { return _transferCommandPool; } vk::CommandPool VulkanBase::graphicsCommandPool() const { return _graphicsCommandPool; } VulkanBase::QueueFamilyIndices VulkanBase::indices() const { return _indices; } uint32_t VulkanBase::getMemoryTypeIndex(uint32_t filter, vk::MemoryPropertyFlags flags) const { vk::PhysicalDeviceMemoryProperties memoryProperties = _physicalDevice.getMemoryProperties(); for (uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++) { bool memorySuitable = static_cast<bool>(filter & (1 << i)); bool hasCorrectProperties = (memoryProperties.memoryTypes[i].propertyFlags & flags) == flags; if (memorySuitable && hasCorrectProperties) return i; } return std::numeric_limits<uint32_t>::max(); } void VulkanBase::getLayoutParameters(vk::ImageLayout layout, vk::PipelineStageFlags& stage, vk::AccessFlags& accessFlags) { if (layout == vk::ImageLayout::eUndefined) { stage = vk::PipelineStageFlagBits::eTopOfPipe; accessFlags = vk::AccessFlags(); } else if (layout == vk::ImageLayout::eTransferDstOptimal) { stage = vk::PipelineStageFlagBits::eTransfer; accessFlags = vk::AccessFlagBits::eTransferWrite; } else if (layout == vk::ImageLayout::eShaderReadOnlyOptimal) { stage = vk::PipelineStageFlagBits::eFragmentShader; accessFlags = vk::AccessFlagBits::eShaderRead; } else if (layout == vk::ImageLayout::eDepthStencilAttachmentOptimal) { stage = vk::PipelineStageFlagBits::eEarlyFragmentTests; accessFlags = vk::AccessFlagBits::eDepthStencilAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite; } else { throw std::runtime_error("Could not get layout parameters for a layout!"); } } vk::Instance VulkanBase::createInstance(const std::vector<const char*>& extensions, const std::vector<const char*>& layers) { vk::ApplicationInfo appInfo = vk::ApplicationInfo() .setApiVersion(VK_API_VERSION_1_0) .setPApplicationName("Orbit Engine") .setApplicationVersion(VK_MAKE_VERSION(1, 0, 0)) .setPEngineName("Orbit Engine") .setEngineVersion(VK_MAKE_VERSION(1, 0, 0)); vk::InstanceCreateInfo createInfo = vk::InstanceCreateInfo() .setEnabledExtensionCount(static_cast<uint32_t>(extensions.size())) .setPpEnabledExtensionNames(extensions.data()) .setEnabledLayerCount(static_cast<uint32_t>(layers.size())) .setPpEnabledLayerNames(layers.data()) .setPApplicationInfo(&appInfo); return vk::createInstance(createInfo); } vk::DebugReportCallbackEXT VulkanBase::createDebugReportCallback(const vk::Instance& instance) { if (!UseValidation)//if constexpr return nullptr; PFN_vkCreateDebugReportCallbackEXT func = (PFN_vkCreateDebugReportCallbackEXT)_instance.getProcAddr("vkCreateDebugReportCallbackEXT"); if (!func) throw std::runtime_error("Attempted to create a debug callback, but the extension is not present!"); vk::DebugReportCallbackCreateInfoEXT createInfo = vk::DebugReportCallbackCreateInfoEXT() .setFlags(vk::DebugReportFlagBitsEXT::eError | vk::DebugReportFlagBitsEXT::eWarning | vk::DebugReportFlagBitsEXT::ePerformanceWarning) .setPfnCallback(debugCallbackFunc); VkDebugReportCallbackCreateInfoEXT cCreateInfo = static_cast<VkDebugReportCallbackCreateInfoEXT>(createInfo); VkDebugReportCallbackEXT debugReportCallback = nullptr; if (VK_SUCCESS != func(static_cast<VkInstance>(_instance), &cCreateInfo, nullptr, &debugReportCallback)) throw std::runtime_error("There was an error createing the debug report callback!"); return debugReportCallback; } vk::SurfaceKHR VulkanBase::createSurface(void* windowHandle, const vk::Instance& instance) { VkSurfaceKHR surface = nullptr; #if defined(USE_WIN32) #error Win32Window not implemented yet #elif defined(USE_XWINDOW) #error XWindow not implemented yet #elif defined(USE_WAYLAND) #error WaylandWindow not implemented yet #else glfwCreateWindowSurface( static_cast<VkInstance>(_instance), static_cast<GLFWwindow*>(windowHandle), nullptr, &surface); #endif return surface; } vk::PhysicalDevice VulkanBase::pickPhysicalDevice(const vk::Instance& instance, const vk::SurfaceKHR& surface) { std::vector<vk::PhysicalDevice> systemDevices = instance.enumeratePhysicalDevices(); if (systemDevices.empty()) throw std::runtime_error("Could not find a physical device that supports Vulkan!"); vk::PhysicalDevice bestDevice = nullptr; for (const vk::PhysicalDevice& device : systemDevices) { vk::PhysicalDeviceProperties deviceProperties = device.getProperties(); vk::PhysicalDeviceFeatures deviceFeatures = device.getFeatures(); std::vector<vk::ExtensionProperties> extensionProperties = device.enumerateDeviceExtensionProperties(); // TODO: More checks here to get a more suitable device if applicable as the renderer becomes // more complex. // Check if the device can handle sampler anisotropy. Otherwise ignore it. if (!deviceFeatures.samplerAnisotropy) continue; // Check whether or not the device can actually render on our surface, which is pretty important // considering we're attempting to do some rendering. // Applying negative logic here saves simplifies code. std::set<std::string> requiredExtensions{ VK_KHR_SWAPCHAIN_EXTENSION_NAME }; for (const vk::ExtensionProperties& extension : extensionProperties) requiredExtensions.erase(extension.extensionName); if (!requiredExtensions.empty()) continue; // Now we know that we have the required extensions, but do we have the required swap chain support? std::vector<vk::SurfaceFormatKHR> formats = device.getSurfaceFormatsKHR(surface); std::vector<vk::PresentModeKHR> presentModes = device.getSurfacePresentModesKHR(surface); if (formats.empty() || presentModes.empty()) continue; // Check for device queues - there should at least be graphics, present and transfer queues // (which might overlap, and that doesn't really matter). QueueFamilyIndices queueFamilies = retrieveQueueFamilyIndices(device, surface); if (!queueFamilies.completed()) continue; // Always prefer discrete GPUs over integrated (or virtual). if (deviceProperties.deviceType == vk::PhysicalDeviceType::eDiscreteGpu) return device; if (deviceProperties.deviceType == vk::PhysicalDeviceType::eIntegratedGpu || deviceProperties.deviceType == vk::PhysicalDeviceType::eVirtualGpu) bestDevice = device; } if (!bestDevice) throw std::runtime_error("Could not choose a suitable physical device that support Vulkan!"); return bestDevice; } vk::Device VulkanBase::createDevice(const vk::PhysicalDevice& device, const QueueFamilyIndices& queueFamilies) { std::set<uint32_t> uniqueQueues{ queueFamilies.uniqueQueues() }; std::vector<vk::DeviceQueueCreateInfo> queueCreateInfos; queueCreateInfos.reserve(uniqueQueues.size()); for (uint32_t queueFamily : uniqueQueues) { const float queuePriority = 1.f; queueCreateInfos.push_back(vk::DeviceQueueCreateInfo() .setQueueFamilyIndex(queueFamily) .setQueueCount(1) .setPQueuePriorities(&queuePriority)); } vk::PhysicalDeviceFeatures deviceFeatures = vk::PhysicalDeviceFeatures() .setSamplerAnisotropy(VK_TRUE); std::vector<const char*> validationLayers; if (UseValidation)//if constexpr validationLayers.insert(validationLayers.end(), ValidationLayers.begin(), ValidationLayers.end()); vk::DeviceCreateInfo createInfo{ vk::DeviceCreateFlags(), static_cast<uint32_t>(queueCreateInfos.size()), queueCreateInfos.data(), static_cast<uint32_t>(validationLayers.size()), validationLayers.data(), static_cast<uint32_t>(RequiredDeviceExtensions.size()), RequiredDeviceExtensions.data(), &deviceFeatures }; return device.createDevice(createInfo); } vk::CommandPool VulkanBase::createCommandPool(const vk::Device& device, uint32_t queueFamilyIndex) { vk::CommandPoolCreateInfo createInfo = vk::CommandPoolCreateInfo() .setFlags(vk::CommandPoolCreateFlagBits::eTransient | vk::CommandPoolCreateFlagBits::eResetCommandBuffer) .setQueueFamilyIndex(queueFamilyIndex); return device.createCommandPool(createInfo); } void VulkanBase::destroyDebugCallback(const vk::Instance& instance, vk::DebugReportCallbackEXT& callback) { PFN_vkDestroyDebugReportCallbackEXT func = (PFN_vkDestroyDebugReportCallbackEXT)instance.getProcAddr("vkDestroyDebugReportCallbackEXT"); if (!func) throw std::runtime_error("Could not find the function to destroy a debug callback!"); func(static_cast<VkInstance>(_instance), static_cast<VkDebugReportCallbackEXT>(callback), nullptr); callback = nullptr; } VulkanBase::QueueFamilyIndices VulkanBase::retrieveQueueFamilyIndices(const vk::PhysicalDevice& physicalDevice, const vk::SurfaceKHR& surface) { QueueFamilyIndices families; std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties(); for (size_t i = 0; i < queueFamilyProperties.size(); i++) { const vk::QueueFamilyProperties& queueFamilyProperty = queueFamilyProperties[i]; if (queueFamilyProperty.queueCount == 0) continue; uint32_t familyIndex = static_cast<uint32_t>(i); if (queueFamilyProperty.queueFlags & vk::QueueFlagBits::eGraphics) families.graphicsQueueFamily = familyIndex; if (physicalDevice.getSurfaceSupportKHR(familyIndex, surface)) families.presentQueueFamily = familyIndex; if (queueFamilyProperty.queueFlags & vk::QueueFlagBits::eTransfer) families.transferQueueFamily = familyIndex; if (families.completed()) break; } return families; }
31.742553
142
0.779878
JusticesHand
acef8a783993b913184fc0b58bab11983ffca7cf
821
hh
C++
include/khmer/_cpy_countgraph.hh
wltrimbl/khmer
ff95776eabee96420f1ae43d0eff562682cbb17b
[ "CNRI-Python" ]
null
null
null
include/khmer/_cpy_countgraph.hh
wltrimbl/khmer
ff95776eabee96420f1ae43d0eff562682cbb17b
[ "CNRI-Python" ]
null
null
null
include/khmer/_cpy_countgraph.hh
wltrimbl/khmer
ff95776eabee96420f1ae43d0eff562682cbb17b
[ "CNRI-Python" ]
null
null
null
#ifndef _CPY_COUNTGRAPH_HH #define _CPY_COUNTGRAPH_HH #include <Python.h> #include "_cpy_utils.hh" #include "_cpy_hashgraph.hh" namespace khmer { typedef struct { khmer_KHashgraph_Object khashgraph; oxli::Countgraph * countgraph; } khmer_KCountgraph_Object; extern PyTypeObject khmer_KCountgraph_Type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("khmer_KCountgraph_Object"); extern PyMethodDef khmer_countgraph_methods[]; PyObject* khmer_countgraph_new(PyTypeObject * type, PyObject * args, PyObject * kwds); void khmer_countgraph_dealloc(khmer_KCountgraph_Object * obj); PyObject * count_get_raw_tables(khmer_KCountgraph_Object * self, PyObject * args); PyObject * count_do_subset_partition_with_abundance(khmer_KCountgraph_Object * me, PyObject * args); } #endif
22.805556
71
0.771011
wltrimbl
acf5a4d1c5bada979452ea50c9d6fd52e3b599d6
3,554
cpp
C++
experiments/Experiment08/M8E8_apw5450.cpp
austinmwhaley/cmps121
d2ae8bad2f5cc6aee50e13f2b5b1a98f041de088
[ "MIT" ]
null
null
null
experiments/Experiment08/M8E8_apw5450.cpp
austinmwhaley/cmps121
d2ae8bad2f5cc6aee50e13f2b5b1a98f041de088
[ "MIT" ]
null
null
null
experiments/Experiment08/M8E8_apw5450.cpp
austinmwhaley/cmps121
d2ae8bad2f5cc6aee50e13f2b5b1a98f041de088
[ "MIT" ]
null
null
null
//Author: Austin Whaley, APW5450, 2019-03-03 //Class: CMPSC 121 //Experiment: 08 //File: cmpsc121/experiments/Experiment08/M7A15_apw5450.cpp //Purpose: Develop Confidence with random numbers /********************************************************************\ * Academic Integrity Affidavit: * * I certify that, this program code is my work. Others may have * * assisted me with planning and concepts, but the code was written, * * solely, by me. * * I understand that submitting code which is totally or partially * * the product of other individuals is a violation of the Academic * * Integrity Policy and accepted ethical precepts. Falsified * * execution results are also results of improper activities. Such * * violations may result in zero credit for the assignment, reduced * * credit for the assignment, or course failure. * \********************************************************************/ /* Out = 58.0 Walk = 9.70 Single = 22.0 Double = 6.1 Triple = 2.5 Home Run = 1.7 - Based on the above percentages, write a program to simulate Casey stepping up to the plate 1000 times and count and display the number of categories. - Then calculate and display his batting average - Enclose login in a do-while loop asking the user if they want to continue <Y or N> (run another simulation) - Run and capture at least 2 simulations */ #include <iostream> #include <cstdlib> // srand & rand function #include <ctime> // time function using namespace std; int main() { unsigned seed = time(0); srand(seed); double batting_avg; int min_val=0, max_val=1000, s, out, walk, single, doubl, triple, homerun; char conf; // Simulation do { // Reset initial values out =0; walk =0; single =0; doubl =0; triple =0; homerun =0; for (int i=0; i < 1000; i++) { s = (rand() % (max_val - min_val + 1)) + min_val; if (s >= 0 && s <= 580) { out += 1; } else if (s > 580 && s <= 677) { walk += 1; } else if (s > 677 && s <= 897) { single += 1; } else if (s > 897 && s <= 958) { doubl += 1; } else if (s > 958 && s <= 983) { triple += 1; } else { homerun += 1; } // end if-tree } // end for-loop batting_avg = static_cast<float>(single + doubl + triple + homerun)/ static_cast<float>(1000 - walk); cout << "Outs = " << out << endl; cout << "Walks = " << walk << endl; cout << "Singles = " << single << endl; cout << "Doubles = " << doubl << endl; cout << "Triples = " << triple << endl; cout << "Home Runs = " << homerun << endl; cout << "Batting AVG = " << batting_avg << endl; cout << "Do you have another purchase to enter? <Y or N> " << endl; cin >> conf; } while (conf == 'Y'); // end do-while loop return 0; } // end main /* Execution Sample Outs = 607 Walks = 105 Singles = 192 Doubles = 58 Triples = 24 Home Runs = 14 Batting AVG = 0.321788 Do you have another purchase to enter? <Y or N> Y Outs = 589 Walks = 95 Singles = 217 Doubles = 61 Triples = 24 Home Runs = 14 Batting AVG = 0.349171 Do you have another purchase to enter? <Y or N> Y Outs = 561 Walks = 85 Singles = 235 Doubles = 82 Triples = 20 Home Runs = 17 Batting AVG = 0.386885 Do you have another purchase to enter? <Y or N> N */
26.132353
79
0.558244
austinmwhaley
acf90af34b816b8823c4e40426c066c2e9223c46
1,239
cpp
C++
Application/source/db/migrations/6_RemoveImages.cpp
RoutineFree/TriPlayer
4e5ee19c992eba033b57444b7f4b312acf339163
[ "MIT" ]
106
2020-11-01T09:58:37.000Z
2022-03-26T10:44:26.000Z
Application/source/db/migrations/6_RemoveImages.cpp
RoutineFree/TriPlayer
4e5ee19c992eba033b57444b7f4b312acf339163
[ "MIT" ]
30
2020-11-01T11:21:48.000Z
2022-02-01T23:09:47.000Z
Application/source/db/migrations/6_RemoveImages.cpp
RoutineFree/TriPlayer
4e5ee19c992eba033b57444b7f4b312acf339163
[ "MIT" ]
15
2020-11-02T12:06:03.000Z
2021-08-05T14:22:39.000Z
#include "db/migrations/6_RemoveImages.hpp" namespace Migration { std::string migrateTo6(SQLite * db) { // Add triggers to delete images when a relevant row is deleted bool ok = db->prepareAndExecuteQuery("CREATE TRIGGER deleteAlbumImage AFTER DELETE ON Albums WHEN removeImage(OLD.image_path) BEGIN SELECT 0 WHERE 1; END;"); if (!ok) { return "Failed to create 'deleteAlbumImage' trigger"; } ok = db->prepareAndExecuteQuery("CREATE TRIGGER deleteArtistImage AFTER DELETE ON Artists WHEN removeImage(OLD.image_path) BEGIN SELECT 0 WHERE 1; END;"); if (!ok) { return "Failed to create 'deleteArtistImage' trigger"; } ok = db->prepareAndExecuteQuery("CREATE TRIGGER deletePlaylistImage AFTER DELETE ON Playlists WHEN removeImage(OLD.image_path) BEGIN SELECT 0 WHERE 1; END;"); if (!ok) { return "Failed to create 'deletePlaylistImage' trigger"; } // Bump up version number (only done if everything passes) ok = db->prepareAndExecuteQuery("UPDATE Variables SET value = 6 WHERE name = 'version';"); if (!ok) { return "Unable to set version to 6"; } return ""; } };
45.888889
166
0.649718
RoutineFree
acfb66918f9c2725bb3c91b819491bd3004fd4a3
3,783
cpp
C++
src/Plugins/GOAPPlugin/Tasks/TaskAnimatablePlayWait.cpp
Terryhata6/Mengine
dfe36fdc84d7398fbbbd199feffc46c6f157f1d4
[ "MIT" ]
null
null
null
src/Plugins/GOAPPlugin/Tasks/TaskAnimatablePlayWait.cpp
Terryhata6/Mengine
dfe36fdc84d7398fbbbd199feffc46c6f157f1d4
[ "MIT" ]
null
null
null
src/Plugins/GOAPPlugin/Tasks/TaskAnimatablePlayWait.cpp
Terryhata6/Mengine
dfe36fdc84d7398fbbbd199feffc46c6f157f1d4
[ "MIT" ]
null
null
null
#include "TaskAnimatablePlayWait.h" #include "Interface/AnimationInterface.h" #include "Kernel/Logger.h" #include "Kernel/Assertion.h" #include "Kernel/DocumentHelper.h" #include "TaskAnimatablePlayReceiver.h" namespace Mengine { ////////////////////////////////////////////////////////////////////////// TaskAnimatablePlayWait::TaskAnimatablePlayWait( GOAP::Allocator * _allocator, const AnimatablePtr & _animatable, const EventablePtr & _eventable, const DocumentPtr & _doc ) : GOAP::TaskInterface( _allocator ) , m_animatable( _animatable ) , m_eventable( _eventable ) #if MENGINE_DOCUMENT_ENABLE , m_doc( _doc ) #endif { MENGINE_UNUSED( _doc ); } ////////////////////////////////////////////////////////////////////////// TaskAnimatablePlayWait::~TaskAnimatablePlayWait() { } ////////////////////////////////////////////////////////////////////////// bool TaskAnimatablePlayWait::_onRun( GOAP::NodeInterface * _node ) { AnimationInterface * animation = m_animatable->getAnimation(); if( animation == nullptr ) { return true; } animation->play( 0.f ); EventationInterface * eventation = m_eventable->getEventation(); if( eventation == nullptr ) { return true; } TaskAnimatablePlayReceiverPtr receiver = Helper::makeFactorableUnique<TaskAnimatablePlayReceiver>( MENGINE_DOCUMENT_VALUE( m_doc, nullptr ) ); EventReceiverInterfacePtr oldreceiver_end = eventation->addEventReceiver( EVENT_ANIMATION_END, receiver ); EventReceiverInterfacePtr oldreceiver_stop = eventation->addEventReceiver( EVENT_ANIMATION_STOP, receiver ); EventReceiverInterfacePtr oldreceiver_interrupt = eventation->addEventReceiver( EVENT_ANIMATION_INTERRUPT, receiver ); MENGINE_ASSERTION_FATAL( oldreceiver_end == nullptr, "event EVENT_ANIMATION_END override" ); MENGINE_ASSERTION_FATAL( oldreceiver_stop == nullptr, "event EVENT_ANIMATION_STOP override" ); MENGINE_ASSERTION_FATAL( oldreceiver_interrupt == nullptr, "event EVENT_ANIMATION_INTERRUPT override" ); receiver->setGOAPNode( _node ); m_receiver = receiver; return false; } ////////////////////////////////////////////////////////////////////////// bool TaskAnimatablePlayWait::_onSkipable() const { return true; } ////////////////////////////////////////////////////////////////////////// void TaskAnimatablePlayWait::_onSkip() { AnimationInterface * animation = m_animatable->getAnimation(); animation->setLastFrame(); animation->stop(); } ////////////////////////////////////////////////////////////////////////// void TaskAnimatablePlayWait::_onFinally() { EventationInterface * eventation = m_eventable->getEventation(); if( eventation == nullptr ) { return; } EventReceiverInterfacePtr delreceiver_end = eventation->removeEventReceiver( EVENT_ANIMATION_END ); EventReceiverInterfacePtr delreceiver_stop = eventation->removeEventReceiver( EVENT_ANIMATION_STOP ); EventReceiverInterfacePtr delreceiver_interrupt = eventation->removeEventReceiver( EVENT_ANIMATION_INTERRUPT ); MENGINE_ASSERTION_FATAL( m_receiver == delreceiver_end, "event EVENT_ANIMATION_END miss remove" ); MENGINE_ASSERTION_FATAL( m_receiver == delreceiver_stop, "event EVENT_ANIMATION_STOP miss remove" ); MENGINE_ASSERTION_FATAL( m_receiver == delreceiver_interrupt, "event EVENT_ANIMATION_INTERRUPT miss remove" ); m_receiver = nullptr; m_animatable = nullptr; m_eventable = nullptr; } }
38.602041
176
0.613534
Terryhata6
acfe52437cdad9d506c58b9f9d051007341c2bee
2,791
cpp
C++
2018_11_04/src/main.cpp
dafer45/SecondTech
262dda0c3599d182bf4bf51df595078c93b19b20
[ "Apache-2.0" ]
3
2018-10-29T04:33:16.000Z
2019-07-10T18:28:27.000Z
2018_11_04/src/main.cpp
dafer45/SecondTech
262dda0c3599d182bf4bf51df595078c93b19b20
[ "Apache-2.0" ]
null
null
null
2018_11_04/src/main.cpp
dafer45/SecondTech
262dda0c3599d182bf4bf51df595078c93b19b20
[ "Apache-2.0" ]
null
null
null
/* Copyright 2018 Kristofer Björnson * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "TBTK/Array.h" #include "TBTK/Model.h" #include "TBTK/PropertyExtractor/Diagonalizer.h" #include "TBTK/Solver/Diagonalizer.h" #include "TBTK/Streams.h" #include "TBTK/TBTK.h" using namespace std; using namespace TBTK; int main(int argc, char **argv){ //Initialize TBTK. Initialize(); //Parameters. const int SIZE_X = 4; const int SIZE_Y = 3; double t = 1; //Create the Model. Model model; for(unsigned int x = 0; x < SIZE_X; x++){ for(unsigned int y = 0; y < SIZE_Y; y++){ model << HoppingAmplitude( 4*t, {x, y}, {x, y} ); if(x + 1 < SIZE_X){ model << HoppingAmplitude( -t, {x + 1, y}, {x, y} ) + HC; } if(y + 1 < SIZE_Y){ model << HoppingAmplitude( -t, {x, y + 1}, {x, y} ) + HC; } } } model.construct(); //Get the HoppingAmplitudeSet from the Model and extract the basis //size. const HoppingAmplitudeSet &hoppingAmplitudeSet = model.getHoppingAmplitudeSet(); unsigned int basisSize = hoppingAmplitudeSet.getBasisSize(); //Initialize the Hamiltonian on a format most suitable for the //algorithm at hand. Array<complex<double>> hamiltonian({basisSize, basisSize}, 0.); //Iterate over the HoppingAmplitudes. for( HoppingAmplitudeSet::ConstIterator iterator = hoppingAmplitudeSet.cbegin(); iterator != hoppingAmplitudeSet.cend(); ++iterator ){ //Extract the amplitude and physical indices from the //HoppingAmplitude. complex<double> amplitude = (*iterator).getAmplitude(); const Index &toIndex = (*iterator).getToIndex(); const Index &fromIndex = (*iterator).getFromIndex(); //Convert the physical indices to linear indices. unsigned int row = hoppingAmplitudeSet.getBasisIndex(toIndex); unsigned int column = hoppingAmplitudeSet.getBasisIndex( fromIndex ); //Write the amplitude to the Hamiltonian that will be used in //this algorithm. hamiltonian[{row, column}] += amplitude; } //Print the Hamiltonian. for(unsigned int row = 0; row < basisSize; row++){ for(unsigned int column = 0; column < basisSize; column++){ Streams::out << real(hamiltonian[{row, column}]) << "\t"; } Streams::out << "\n"; } return 0; }
26.084112
75
0.681834
dafer45
4a00f6a8c140aa42075347ce520ba22e120383c0
1,003
cpp
C++
core/source/detail/string_view.cpp
GremSnoort/actor-zeta
ec9f5624871f1fe3b844bb727e80388ba6c0557e
[ "BSD-3-Clause" ]
null
null
null
core/source/detail/string_view.cpp
GremSnoort/actor-zeta
ec9f5624871f1fe3b844bb727e80388ba6c0557e
[ "BSD-3-Clause" ]
null
null
null
core/source/detail/string_view.cpp
GremSnoort/actor-zeta
ec9f5624871f1fe3b844bb727e80388ba6c0557e
[ "BSD-3-Clause" ]
null
null
null
#include <actor-zeta/detail/string_view.hpp> #if CPP17_OR_GREATER #elif CPP14_OR_GREATER or CPP11_OR_GREATER #include <ostream> namespace std { std::ostream &operator<<(std::ostream &out, actor_zeta::detail::string_view str) { for (auto ch : str) out.put(ch); return out; } string to_string(actor_zeta::detail::string_view v) { return string(v.begin(), v.end()); /// TODO: } } namespace actor_zeta { namespace detail { int string_view::compare(actor_zeta::detail::string_view str) const noexcept { auto s0 = size(); auto s1 = str.size(); auto fallback = [](int x, int y) { return x == 0 ? y : x; }; if (s0 == s1) return strncmp(data(), str.data(), s0); else if (s0 < s1) return fallback(strncmp(data(), str.data(), s0), -1); return fallback(strncmp(data(), str.data(), s1), 1); } }} #endif
26.394737
86
0.54337
GremSnoort
4a02c2e670b5085f6cbe172f79925b143a31ae7e
2,159
hpp
C++
include/rrl/cm/cm_no_reset.hpp
umbreensabirmain/readex-rrl
0cb73b3a3c6948a8dbdce96c240b24d8e992c2fe
[ "BSD-3-Clause" ]
1
2019-10-09T09:15:47.000Z
2019-10-09T09:15:47.000Z
include/rrl/cm/cm_no_reset.hpp
readex-eu/readex-rrl
ac8722c44f84d65668e2a60e4237ebf51b298c9b
[ "BSD-3-Clause" ]
null
null
null
include/rrl/cm/cm_no_reset.hpp
readex-eu/readex-rrl
ac8722c44f84d65668e2a60e4237ebf51b298c9b
[ "BSD-3-Clause" ]
1
2018-07-13T11:31:05.000Z
2018-07-13T11:31:05.000Z
/* * config_manager.hpp * * Created on: 06.06.2017 * Author: marcel */ #ifndef INCLUDE_CM_NO_RESET_HPP_ #define INCLUDE_CM_NO_RESET_HPP_ #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <mutex> #include <sstream> #include <string> #include <utility> #include <vector> #include <rrl/cm/cm_base.hpp> #include <tmm/parameter_tuple.hpp> #include <util/log.hpp> namespace rrl { namespace cm { /** This class controls the settings stack. * * Only the current configuration will be stored on the stack. When creating the configuration * manager the default configuration is stored. If a new configuration is set the current one will * be modified. If unset is called the current configuration will be returned without removing. * */ class cm_no_reset : public cm_base { public: /** * Constructor * * @brief Constructor * * Initializes the configuration manager with the default configuration. * * @param default_configs default configuration * **/ cm_no_reset(setting default_configs); /** * Destructor * * @brief Destructor * Deletes the configuration manager * **/ ~cm_no_reset(); /** sets parameter * * It compares current with new configuration. If the parameter exists with the same value a *debug * message is printed. If the parameter value differs the new one will be set. If the parameter * doesn't exist it won't be touched. * If the new configuration contains parameters that don't exist in the current configuration *they * will be saved in the settings stack. * * @param new_configs new configuration * **/ void set(setting configs) override; /** returns a copy of the current configuration. * * @return returns a copy of the current configuration. * */ setting unset() override; void atp_add(tmm::parameter_tuple hash) override; setting get_current_config() override; private: setting settings; /**< settings stack with configurations consisting of parameter tuples*/ }; } } #endif /* INCLUDE_CM_NO_RESET_HPP_ */
23.467391
99
0.691524
umbreensabirmain
4a04a4fc080162297ab1faa9e7d1e1ca936e9c20
245
cpp
C++
04. Recursion/taylorseriesiterative.cpp
pratik8696/DSA
049a76b6e2445bb5de2e87f3755038609006c06a
[ "MIT" ]
2
2021-09-27T14:12:28.000Z
2021-09-28T03:35:46.000Z
04. Recursion/taylorseriesiterative.cpp
pratik8696/DSA
049a76b6e2445bb5de2e87f3755038609006c06a
[ "MIT" ]
2
2021-09-30T09:07:11.000Z
2021-10-17T18:42:34.000Z
04. Recursion/taylorseriesiterative.cpp
pratik8696/DSA
049a76b6e2445bb5de2e87f3755038609006c06a
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int iterative(int x,int n) { static int s=1; for(;n>0;n--) { s=1+x/n*s; } return s; } int main() { int x,n; cin>>x>>n; cout<<iterative(x,n); return 0; }
11.666667
26
0.493878
pratik8696
4a053aadc637d67124c9c9c6854b80eb6d5d96f8
790
cpp
C++
codes/UVA/10001-19999/uva10115.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/UVA/10001-19999/uva10115.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/UVA/10001-19999/uva10115.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
#include<stdio.h> #include<iostream> #include<string.h> using namespace std; #define N 15 #define M 85 #define K 260 int main() { char before[N][M], after[N][M]; char str[K], tem[K]; int n; while (cin >> n, n) { getchar(); // Init. memset(before, 0, sizeof(before)); memset(after, 0, sizeof(after)); memset(str, 0, sizeof(str)); // Read. for (int i = 0; i < n; i++) { gets(before[i]); gets(after[i]); } gets(str); // Judge. for (int i = 0; i < n; i++) { int t = strlen(before[i]); int k = strlen(after[i]); do{ char *move = NULL; move = strstr(str, before[i]); if (move == NULL) break; strcpy(tem, move + t); strcpy(move, after[i]); strcpy(move + k, tem); }while (1); } puts(str); } return 0; }
14.90566
36
0.534177
JeraKrs
4a07af97299eb23ec1169cd59022da232c736bf9
1,446
hpp
C++
src/TypeInfo.hpp
MustafaSabur/RobotWereld
e696e6e7ad890abb719a78fc1a0c111a680d27e0
[ "BSD-2-Clause" ]
null
null
null
src/TypeInfo.hpp
MustafaSabur/RobotWereld
e696e6e7ad890abb719a78fc1a0c111a680d27e0
[ "BSD-2-Clause" ]
null
null
null
src/TypeInfo.hpp
MustafaSabur/RobotWereld
e696e6e7ad890abb719a78fc1a0c111a680d27e0
[ "BSD-2-Clause" ]
null
null
null
#ifndef TYPEINFO_HPP_ #define TYPEINFO_HPP_ /* * Copyright (c) 1997 - 2013 Askesis B.V. See license.txt for details. * For information, bug reports and additions send an e-mail to [email protected]. * * Author: jkr */ #include <cstdlib> #include <typeinfo> #include <cxxabi.h> #include <string> /** * @return The demangled (human readable) version of the name() string for std::type_info */ inline std::string demangleTypeInfo(const std::type_info& aTypeInfo) { int status; char* realname; realname = abi::__cxa_demangle(aTypeInfo.name(), 0, 0, &status); std::string result(realname); std::free(realname); return result; } /** * @return The demangled (human readable) version of aTypeInfoString which should contain the name() string for std::type_info */ inline std::string demangleTypeInfo(const std::string& aTypeInfoString) { int status; char* realname; realname = abi::__cxa_demangle(aTypeInfoString.c_str(), 0, 0, &status); std::string result(realname); std::free(realname); return result; } /** * @return The demangled (human readable) version of the name() string for type T */ template<typename T> inline std::string typeinfoFor(const T& x) { return demangleTypeInfo(typeid(x)); } /** * @return The demangled (human readable) version of the name() string for type T */ template<typename T> inline std::string typeinfoFor(T const* & x) { return demangleTypeInfo(typeid(x)); } #endif // DANU_TYPEINFO_HPP_
23.322581
126
0.722683
MustafaSabur
4a12bef02a73ba8fbc5f46e0dc69754b06740074
7,721
cpp
C++
Engine/gkDebugFps.cpp
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
241
2015-01-04T00:36:58.000Z
2022-01-06T19:19:23.000Z
Engine/gkDebugFps.cpp
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
10
2015-07-10T18:27:17.000Z
2019-06-26T20:59:59.000Z
Engine/gkDebugFps.cpp
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
82
2015-01-25T18:02:35.000Z
2022-03-05T12:28:17.000Z
/* ------------------------------------------------------------------------------- This file is part of OgreKit. http://gamekit.googlecode.com/ Copyright (c) 2006-2013 Xavier T. Contributor(s): Charlie C. ------------------------------------------------------------------------------- This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ------------------------------------------------------------------------------- */ #include "gkDebugFps.h" #include "gkLogger.h" #include "gkWindowSystem.h" #include "gkWindow.h" #include "gkEngine.h" #include "gkScene.h" #include "gkDynamicsWorld.h" #include "gkStats.h" #include "OgreOverlayManager.h" #include "OgreOverlayElement.h" #include "OgreOverlayContainer.h" #include "OgreFont.h" #include "OgreFontManager.h" #include "OgreTextAreaOverlayElement.h" #include "OgreRenderWindow.h" #include "OgreRenderTarget.h" #define PROP_SIZE 14 gkDebugFps::gkDebugFps() : m_isInit(false), m_isShown(false), m_over(0), m_cont(0), m_key(0), m_val(0) { m_keys = ""; m_keys += "FPS:\n"; m_keys += "Average:\n"; m_keys += "Best:\n"; m_keys += "Worst:\n"; m_keys += "\n"; m_keys += "Triangles:\n"; m_keys += "Batch count:\n"; m_keys += "\n"; m_keys += "DBVT:\n"; m_keys += "\n"; m_keys += "Total:\n"; m_keys += "Render:\n"; m_keys += "Physics:\n"; m_keys += "LogicBricks:\n"; m_keys += "LogicNodes:\n"; m_keys += "Sound:\n"; m_keys += "DBVT:\n"; m_keys += "Bufferswap&LOD:\n"; m_keys += "Animations:\n"; } gkDebugFps::~gkDebugFps() { } void gkDebugFps::initialize(void) { if (m_isInit) return; try { // always initialize after gkDebugScreen! Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton(); m_over = mgr.create("<gkBuiltin/gkDebugFps>"); m_key = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugFps/Keys>"); m_val = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugFps/Vals>"); m_cont = (Ogre::OverlayContainer*)mgr.createOverlayElement("Panel", "<gkBuiltin/gkDebugFps/Containter1>"); m_cont->setMetricsMode(Ogre::GMM_PIXELS); m_cont->setVerticalAlignment(Ogre::GVA_TOP); m_cont->setHorizontalAlignment(Ogre::GHA_RIGHT); m_cont->setLeft(-16 * PROP_SIZE); m_cont->setTop(10); m_key->setMetricsMode(Ogre::GMM_PIXELS); m_key->setVerticalAlignment(Ogre::GVA_TOP); m_key->setHorizontalAlignment(Ogre::GHA_LEFT); m_val->setMetricsMode(Ogre::GMM_PIXELS); m_val->setVerticalAlignment(Ogre::GVA_TOP); m_val->setHorizontalAlignment(Ogre::GHA_LEFT); m_val->setLeft(8 * PROP_SIZE); Ogre::TextAreaOverlayElement* textArea; textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_key); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(PROP_SIZE); textArea->setColour(Ogre::ColourValue::White); textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_val); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(PROP_SIZE); textArea->setColour(Ogre::ColourValue::White); m_over->setZOrder(500); m_cont->addChild(m_key); m_cont->addChild(m_val); m_over->add2D(m_cont); } catch (Ogre::Exception& e) { gkPrintf("%s", e.getDescription().c_str()); return; } m_isInit = true; } void gkDebugFps::show(bool v) { if (m_over != 0 && m_isShown != v) { m_isShown = v; if (m_isShown) m_over->show(); else m_over->hide(); } } void gkDebugFps::draw(void) { if (!m_over || !m_key || !m_val) return; Ogre::RenderWindow* window = gkWindowSystem::getSingleton().getMainWindow()->getRenderWindow(); const Ogre::RenderTarget::FrameStats& ogrestats = window->getStatistics(); gkVariable* dbvtVal = 0; gkDynamicsWorld* wo = gkEngine::getSingleton().getActiveScene()->getDynamicsWorld(); if (wo) dbvtVal = wo->getDBVTInfo(); float swap = gkStats::getSingleton().getLastTotalMicroSeconds() / 1000.0f; float render = gkStats::getSingleton().getLastRenderMicroSeconds() / 1000.0f; float phys = gkStats::getSingleton().getLastPhysicsMicroSeconds() / 1000.0f; float logicb = gkStats::getSingleton().getLastLogicBricksMicroSeconds() / 1000.0f; float logicn = gkStats::getSingleton().getLastLogicNodesMicroSeconds() / 1000.0f; float sound = gkStats::getSingleton().getLastSoundMicroSeconds() / 1000.0f; float dbvt = gkStats::getSingleton().getLastDbvtMicroSeconds() / 1000.0f; float bufswaplod = gkStats::getSingleton().getLastBufSwapLodMicroSeconds() / 1000.0f; float animations = gkStats::getSingleton().getLastAnimationsMicroSeconds() / 1000.0f; #ifdef OGREKIT_USE_PROCESSMANAGER float process = gkStats::getSingleton().getLastProcessMicroSeconds() / 1000.0f; #endif gkString vals = ""; vals += Ogre::StringConverter::toString(ogrestats.lastFPS) + '\n'; vals += Ogre::StringConverter::toString(ogrestats.avgFPS) + '\n'; vals += Ogre::StringConverter::toString(ogrestats.bestFPS) + '\n'; vals += Ogre::StringConverter::toString(ogrestats.worstFPS) + '\n'; vals += '\n'; vals += Ogre::StringConverter::toString(ogrestats.triangleCount) + '\n'; vals += Ogre::StringConverter::toString(ogrestats.batchCount) + '\n'; vals += '\n'; if (dbvtVal) vals += dbvtVal->getValueString(); else vals += "Not Enabled\n"; vals += '\n'; vals += Ogre::StringConverter::toString(swap, 3, 7, '0', std::ios::fixed) + "ms 100%\n"; vals += Ogre::StringConverter::toString(render, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * render / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(phys, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * phys / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(logicb, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * logicb / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(logicn, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * logicn / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(sound, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * sound / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(dbvt, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * dbvt / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(bufswaplod, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * bufswaplod / swap), 3 ) + "%\n"; vals += Ogre::StringConverter::toString(animations, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * animations / swap), 3 ) + "%\n"; #ifdef OGREKIT_USE_PROCESSMANAGER vals += Ogre::StringConverter::toString(process, 3, 7, '0', std::ios::fixed) + "ms "; vals += Ogre::StringConverter::toString( int(100 * process / swap), 3 ) + "%\n"; #endif if (!m_keys.empty() && !vals.empty()) { m_key->setCaption(m_keys); m_val->setCaption(vals); } }
32.995726
109
0.669732
gamekit-developers